On 04:02 am, firstname.lastname@example.org wrote:
At 08:52 AM 4/10/2011 +1000, Ben Finney wrote:
This is an often-overlooked case, I think. The unspoken assumption is often that ``setup.py`` is a suitable place for the overall version string, but this is not the case when that string must be read by non-Python programs.
If you haven't used the distutils a lot, you might not realize that you can do this:
$ python setup.py --version 0.6c12
(The --name option also works, and they can be used together -- the answers will be on two separate lines.)
This only works as long as setup.py is around - which it typically no longer is after installation is complete.
And though it's common and acceptable enough to launch a child process in a shell script in order to get some piece of information, it isn't as pleasant in a Python program. Can you get this version information out of setup.py without running a child process and without monkey-patching sys.argv and sys.stdout?