[Distutils] Skipping namespace file?

Phillip J. Eby pje at telecommunity.com
Fri Jan 5 17:43:46 CET 2007

At 09:05 AM 1/5/2007 -0500, Kurt Schwehr wrote:
>Here is what the pth looks like.  Is there something wrong with it then?
>cat /sw/lib/python2.5/site-packages/dap-
>import sys,new,os; p = os.path.join(sys._getframe(1).f_locals['sitedir'], 
>*('dap', 'plugins')); ie = os.path.exists(os.path.join (p,'__init__.py')); 
>m = not ie and 
>sys.modules.setdefault('dap.plugins',new.module('dap.plugins')); mp = (m 
>or []) and m.__dict__.setdefault('__path__',[]); (p not in mp) and mp.append(p)
>import sys,new,os; p = os.path.join(sys._getframe(1).f_locals['sitedir'], 
>*('dap', 'responses')); ie = 
>os.path.exists(os.path.join(p,'__init__.py')); m = not ie and 
>sys.modules.setdefault(' dap.responses',new.module('dap.responses')); mp = 
>(m or []) and m.__dict__.setdefault('__path__',[]); (p not in mp) and 
>If I read that right, it is not letting python know about the dap module, 
>so that I can't do something like "import dap.client".  Does this mean 
>that the setup.py is not configured correctly to include a "dap"?

Yes, you're right, that is exactly the problem.  There are two possible fixes:

1. add 'dap' to the namespace_packages setting in the setup.py

2. change setuptools to figure out that this is needed

Since setuptools already knows that it shouldn't include the __init__ for 
dap, it can reasonably be considered a setuptools bug that it doesnt' 
generate the .pth correctly for that case, so I will fix that.  In the 
meantime, as a workaround, adding 'dap' to the namespace_packages setting 
will allow you to proceed.

Thanks for your patience and help in identifying the actual bug.

More information about the Distutils-SIG mailing list