[Distutils] Synchronizing version information

Martin von Loewis loewis@informatik.hu-berlin.de
Wed Sep 20 05:57:01 2000


In my package, I have two places which carry version information: in
the setup.py, when passing the version= keyword argument to setup, and
in the package's __init__, to allow runtime access to the available
version.

I'd like these to be synchronized, having the information only in a
single place, and fetching it from there in the other. Is there any
mechanism in distutils to facilitate such synchronization?

One approach would be a autoconf-style replacement mechanism, where I
put

version_info = distutils.version.StrictVersion(@VERSION@)

into the Python source, and 

version = version_string,
substitute = {'VERSION': repr(version_string)}

into setup.py. 'build', 'sdist', etc would update the string
appropriately.

Any comments?

TIA,
Martin