Setting package-wide variables during python setup.py install

Posted by Morgoth on Stack Overflow See other posts from Stack Overflow or by Morgoth
Published on 2010-03-14T16:27:53Z Indexed on 2010/03/14 16:35 UTC
Read the original article Hit count: 247

Filed under:

Is there a way that when a user types

python setup.py install

to install a Python package, setup.py can be made to set specific variables at the base of the pacakge? A common example would be to basically set mypackage.__revision__ to be the svn revision of the checkout if one is working from svn. Another example case would be if the user can choose a global option, so that the option mypackage.__option__ be set according to a flag passed to setup.py, e.g.

python setup.py install --set-flag=10

Then when using the package, mypackage.__option__ would equal 10.

© Stack Overflow or respective owner

Related posts about python