Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting distutils to install prebuilt compiled libraries?

I manage an open source project (Remix, the source is available there) written in python. We ask users to run python setup.py install to install the software. Recently we added a compiled C++ package (a port of SoundTouch -- go to trunk/externals in the source to see it.) We'd like the setup.py file that installs the base Remix libraries to also install the pysoundtouch14 library.

However, we don't want users to have to have a gcc or msvc toolchain on their system. We've precompiled binaries for common platforms (linux-i386, windows, mac 10.5 and 10.6), go to trunk/externals/pysoundtouch14/build to see them. I was hoping that a user who does not have gcc or msvc installed could just run pysoundtouch14's setup.py and it would detect the presence of our prebuilt binaries and just copy them to the right place (/Library/Python/2.5/site-packages, for example.) But that doesn't happen. On a new 10.5 system, for example, setup.py complains about no gcc being installed even though the .so it needs to install is already built in the build/ folder.

So I have two direct questions:

  • How can I get setup.py to just "install" prebuilt .so and .pyd files in the right place automatically depending on the platform without requiring a build system?
  • How can one setup.py (our main setup.py file) also run the setup.py of another included package (pysoundtouch14's setup.py?)
like image 731
bwhitman Avatar asked Jun 16 '09 16:06

bwhitman


2 Answers

Your first question is a tough one given the multiplatform requirement. If it was just windows, you could use the post-installation script option to run a script to handle the libraries or just use a non-python tool such as NSIS. I'm not sure what else can be done other than Almad's suggestion.

For your second question, you might want to look into Paver.

like image 55
Jay Atkinson Avatar answered Oct 17 '22 06:10

Jay Atkinson


Unfortunately, I'd say that overriding install command is the way to go.

This can be done easily, using custom distribution command. For example, see [1] http://svn.zope.org/Zope/branches/2.9/setup.py?rev=69978&view=auto

like image 40
Almad Avatar answered Oct 17 '22 06:10

Almad