[Distutils] How can I get setuptools to include files beyond what find_packages() finds?
Stanley A. Klein
sklein at cpcug.org
Wed Aug 1 23:30:01 CEST 2007
On Tue, 2007-07-31 at 18:05 -0400, Phillip J. Eby wrote:
> At 05:16 PM 7/31/2007 -0400, Stanley A. Klein wrote:
> >Robert Kern wrote:
> >Stanley A. Klein wrote:
> > >> I tried to do something to fix the numpy distutils bdist_rpm.py (by
trying to follow what was done in install.py) but it didn't work
> > >> got an error message I didn't understand.
> > >I'd like to help, but if you don't copy the exact error message here,
> >OK, here is my revised numpy/distutils/commands/bdist_rpm.py (trying --
obviously not well -- to follow what was done in
> Please see my earlier message about "setup.py install --root
> --record" and try that -- it will give us the information to know
whether there's even a problem with numpy's bdist_rpm, or if it's in
numpy's install_lib or build_ext commands. There's no point in
changing the commands around before that.
I ran it and think I have figured out what is happening.
I first ran the build, using "python setup.py build" rather than the "env
CFLAGS="$RPM_OPT_FLAGS" python setup.py build" that appears in the rpm
spec file built by bdist_rpm. I don't know what difference that makes.
The build looked OK.
I then created a buildroot directory and ran "python setup.py install
--root=build/buildroot --record=INSTALLED_FILES". The install looked OK
as well. It included the .so files and also built the .pyo and .pyc files
for the .py files that are used during kiva execution and resulted from
the [install] optimize=1 in setup.cfg. I saved the buildroot directory
I then cleared the build directory and ran "python setup.py bdist_rpm". It
gave me the unpackaged files error as before. I looked at exactly what
files were unpackaged. They turned out to include two kinds of files: (1)
some .pyc and .pyo files for .py files in example and test directories,
and (2) a pair of .pyc and .pyo files for the __init__.py at the top level
of the enthought directory that contains the statement for proper
processing of namespace packages. I'm sure these .pyc
and .pyo files are coming from brp-python-bytecompile that Fedora
rpmbuild runs without requiring __init__.py files in the directories it
The workaround for the example and test directories is to remove them from
the package. Under the Unix File Hierarchy Standard, they don't belong in
/usr/lib/python/site-packages but in /usr/share/packagename+ or
/usr/share/doc/packagename+ (where the "+" indicates adding version
information). I had to do this with another enthought component, and for
that I put them in a directory intended for building a package to install
them in the right location per the FHS.
I don't know what to do about the .pyc and .pyo files for the
__init__.py. It looks like what might be happening is that the rpm spec
file is being built by a combination of the distutils and numpy
distutils functions (which differ from setuptools in the scripts they put
in the spec file, including the env statement build difference shown above
and omitting " --single-version-externally-managed" from the install
options). Then it looks like the build might be executed by the numpy
distutils but the install is being done by setuptools. The
install (both what I executed alone and when done by bdist_rpm) includes
the egg-info directory and the nspkg.pth file. BTW, differencing the
bdist_rpm INSTALLED_FILES and my earlier test INSTALLED_FILES showed the
only difference being the naming of the files in the egg-info and
I think this clarifies what is happening, although I'm not sure how to fix
the issue with the __init__.py file.
Many thanks for insisting that I run the test you suggested. I hope this
helps make the issues clear.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Distutils-SIG