Re: [Distutils] Skipping namespace file?
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-2.2.5.7-py2.5-nspkg.pth 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 mp.append(p)
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.
Sounds good, but I still am confused as to why there should not be a site-packages/dap/__init__.py in the installed lib area. For this package there isn't too much in there, but some packages include things like version numbers and defaults in their __init__.py. For dap, we would be leaving out the overview documentation for import dap;help(dap). If the case really is that there should not be a dap/__init__.py, where do I tell the author of the package to move that documentation such that help(dap) will still provide as much info? Thanks! -kurt
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.
participants (2)
-
Kurt Schwehr
-
Phillip J. Eby