[Distutils] setuptools: including shared libraries the Right Way

Phillip J. Eby pje at telecommunity.com
Fri Feb 9 19:02:48 CET 2007


At 09:34 AM 2/9/2007 -0800, Andrew Straw wrote:
>I'm trying to include shared libraries (built by scons invoked from my
>setup.py script) into built eggs. I can do this just fine with the
>package_data command, but then the egg isn't known to be platform
>dependent. This is somewhat puzzling, because setuptools notices the
>library and lists it in .egg-info/native_libs.txt. Perhaps this is
>expected behavior because, in theory, I could include pre-built native
>libraries of more than one platform, or the native libraries might only
>be required on one platform.
>
>This leads me to the bdist_egg --plat-name option, which doesn't seem to
>work in this case. "python setup.py bdist_egg --plat-name=abc" doesn't
>produce an .egg with "abc" in the filename. This is apparently because
>setuptools thinks the egg doesn't contain C extensions.

More precisely, it's distutils, which setuptools asks to find out if there 
are any.   Unfortunately, at the time setuptools needs to know this, it 
hasn't checked for native libraries yet, because that's an egg-building thing.


>Perhaps the solution to this issue is to tell setuptools "yes, I did
>build C extensions". How would I achieve this?

A quick workaround:

from setuptools.dist import Distribution

class MyDist(Distribution):
     def has_ext_modules(self):
         return True

setup(
     ...
     distclass = MyDist,
)



More information about the Distutils-SIG mailing list