[Distutils] namespace_packages

Charlie Moad cwmoad at gmail.com
Fri Jan 20 17:20:41 CET 2006


On 1/19/06, Robert Kern <robert.kern at gmail.com> wrote:
> Charlie Moad wrote:
> > Well here are th cvs links to them.
> >
> > http://cvs.sourceforge.net/viewcvs.py/matplotlib/matplotlib/setup.py?rev=1.143&view=auto
> > http://cvs.sourceforge.net/viewcvs.py/matplotlib/toolkits/basemap/setup.py?rev=1.33&view=auto
> >
> > The matplotlib.toolkits module does not exist in the mpl cvs and it is
> > not in the setup.py file.  I have tried adding both.  In basemap
> > however, the matplotlib.toolkits module does exist and is listed in
> > the setup.py file.
>
> Both of these setup.py files are buggy. The packages list needs to have entries
> in dotted form ("matplotlib.toolkits"), not filesystem form
> ("matplotlib/toolkits"). Correcting them, and adding an empty
> lib/matplotlib/toolkits/__init__.py to the matplotlib checkout allows me to
> build eggs with namespace_packages set appropriately.
>

I finally got time to try this, and it didn't help much.  Changing all
the packages to dot notation works fine.  I have added the
toolkits/__init__.py file.  Setuptools warns about not having
declare_namespace in the init files.  I have added this:

try:
    __import__('pkg_resources').declare_namespace(__name__)
    print __name__, __file__
except ImportError:
    pass # must not have setuptools

to __init__.py in mpl's and basemap's matplotlib and
matplotlib.toolkits module, hence in 4 places.
Upon starting python I get this output:

matplotlib /usr/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-linux-i686.egg/matplotlib/__init__.pyc
matplotlib.toolkits
/usr/lib/python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-linux-i686.egg/matplotlib/toolkits/__init__.pyc

So the basemap declarations are never being reached.  Where should I
go from here?


More information about the Distutils-SIG mailing list