[Distutils] building a shared lib

Brown, Christopher cbrown1 at pitt.edu
Sun May 27 19:15:39 CEST 2012


I am developing a Python package and use distutils. The package relies 
on a shared lib, for which the build process is slightly more than 
trivial. So, I have created a shell script to build the lib (lets call 
that buildlib.sh). Then, I have another script in the package root 
(buildpackage.sh) that first calls buildlib.sh, and the runs the 
setup.py script to build and/or install the package.

This works fine, but I would like to allow users to just run python 
setup.py build/install to simplify things for them. I can call 
buildlib.sh from within setup.py, but I am unsure of the right way to do 
it. Should I just call buildlib.sh everytime from setup.py, regardless 
of whether it is with 'build' or 'install'? Can I detect if 'build' is 
being run (whether from 'setup.py build' or 'setup.py install') and only 
run it then? Is there a better way to handle this?



Christopher Brown, Ph.D.
Assistant Professor
Department of Communication Science and Disorders
University of Pittsburgh

More information about the Distutils-SIG mailing list