Hi, 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? Thanks! -Chris -- Christopher Brown, Ph.D. Assistant Professor Department of Communication Science and Disorders University of Pittsburgh
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?
You should create a sub-command of the build command. See commands/build.py, and find the current list of subcommands of build. Create a new one, and either monkey-patch build to include this subcommand, or subclass build, and override it. HTH, Martin
participants (2)
-
Brown, Christopher -
martin@v.loewis.de