[Distutils] How can I get setuptools to include files beyond what find_packages() finds?

Stanley A. Klein sklein at cpcug.org
Mon Jul 30 21:15:55 CEST 2007

On Fri, 2007-07-27 at 15:55 -0400, Phillip J. Eby wrote:
> At 03:47 PM 7/27/2007 -0400, Stanley A. Klein wrote:
> >I'm trying to package an rpm for enthought kiva.  The regular setup.py
uses the numpy distutils because of some cpp functions that have to be
compiled and are somehow tied to numpy.
> >
> >Someone recently did a "build in place" program that uses the existing
setup.py (that I renamed setup.original.py) and builds the .so files in
the regular source directory hierarchy.  I did that and then tried to
> >setuptools (python setup.py bdist_rpm) using a straightforward
> >It included all the python files but missed the *.so files.  I can run
kiva examples if I manually put the *.so files into the proper place in
site-packages, so I know they are needed.
> >
> >I tried including
> >
> >  packages = find_packages(),
> >  package_data = {'': ['*.so']},
> >
> >in the setup.py, but it still missed the *.so files.
> >
> >What am I doing wrong?
> You don't want package_data.  setup() needs to actually list the 
extensions.  More precisely, the distutils "install_lib" command  needs
to install the extensions when requested to do so by bdist_rpm.
> The preceding applies to any distutils setup, not just setuptools.

This is very confusing.  The documentation of distutils is very sparse in
this area and doesn't really cover this issue.  I looked at the code and
couldn't figure out anything.  I got a little bit out of the "--help
install_lib" command line option, but couldn't figure it out from that.

It appears that for extensions, distutils expects to build/compile them.
There is some kind of option called skip-build that I don't know how to
invoke and am not sure how will affect optimize=1 in the setup.cfg file,
that calls for it to build the pyc and pyo files that are needed.  I also
couldn't figure out how to specify the .so files to be included.

I don't need to build the .so files.  They are already built.  That had to
be done using the build-in-place and the numpy distutils for reasons I
don't fully understand but are related to the use of numpy.

The reason I tried to use package_data was because I wanted setuptools to
include the files the same as would be done if they were data files --
just put them into the package as they are.

The find_packages() function identifies .py files to be included in the
package.  I want the already-built .so files to be included also.  How do
I make that happen?

Stan Klein

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/distutils-sig/attachments/20070730/15fd699d/attachment.html 

More information about the Distutils-SIG mailing list