[Distutils] __init__.py getting left out of mpkg

jason pellerin jpellerin at gmail.com
Tue Mar 6 20:29:18 CET 2007


> At 07:13 AM 3/5/2007 -0800, Bob Ippolito wrote:
> >On 3/5/07, Christopher Fonnesbeck <fonnesbeck.mailing.lists at gmail.com> wrote:
> > > I have been using bdist_mpkg to build Mac distributions of Numpy,
> > Matplotlib
> > > and other scientific programming packages. However, when I use
> > bdist_mpkg to
> > > build  matplotlib, the resulting package is broken. In particular, I get:
> > >
> > > In [3]: import pylab
> > > ---------------------------------------------------------------------------
> > > exceptions.ImportError                               Traceback (most recent
> > > call last)
> > >
> > > /Users/chris/<ipython console>
> > >
> > >
> > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/pylab.py
> > > ----> 1 from matplotlib.pylab import *
> > >
> > > ImportError: No module named matplotlib.pylab
> > >
> > > Sure enough, when I look into the problem, it seems that the __init__.py
> > > file is being left out by distutils. If I install directly using setup.py,
> > > this does not occur.
> > >
> > > Any ideas?
> > >
> >
> >I've never seen that happen before. Must be something funny matplotlib
> >is doing...
>
> When a namespace package is installed using a backward-compatibility mode,
> the __init__.py goes away, otherwise you'll have multiple packages
> installing it.  Is bdist_mpkg not including the .pth file that setuptools
> generates to handle this?

I've been meaning to ask about this same issue, specifically with
respect to namespace packages, bdist_rpm and imp. I've had to patch
the spec files for all namespace packages that we build as RPMs, since
although the .pth file works when using import or __import__, imp
doesn't seem to recognize it, and that breaks Paste's app loading. So
I have to have the RPMs put a dummy __init__.py in the package --
which has problems of its own, but at least leaves me with a
functional install.

I'm wondering if it's a known issue that imp can't/doesn't use .pth
files, and if so, is there any other way to handle namespace packages
in --single-version-externally-managed besides .pth files?

JP


More information about the Distutils-SIG mailing list