To avoid namespace confliction with other Python packages, I want all
my projects to be put into a specific namespace, e.g. 'hongqn' package,
so that I can use "from hongqn.proj1 import module1", "from
hongqn.proj2.subpack1 import module2", etc.
These projects are developed and maintained and distributed seperately,
so I should not make a whole 'hongqn' package with one setup.py. I
must write setup.py scripts for each project. I meet a problem here.
For instance, I am writing setup.py script for proj1. I use the
following parameters when calling distutils.core.setup:
setup(
...
package_dir = {'hongqn.proj1': 'proj1'},
packages = ['hongqn.proj1'],
...
)
"python setup.py install" will create /usr/lib/python2.3/hongqn/proj1
directory and copy proj1/*.py there. But this is UNUSABLE! There is
NO __init__.py file under /usr/lib/python2.3/hongqn/ so that import
hongqn.proj1 will fail!
I am considering manually create this __init__.py by hacking the
install_lib command. But before making my hands dirty, I want to know
if there is an "official" solution exists or others have already
success stories on this matter.
As a note, I wish the solution can handle setup.py bdist and
bdist_wininst well.