What do people use to avoid repeating the version number both in the setup.py as well as in application/library code, when the application/library wants to know its own version number?
I've seen several options:
1) put __version__ = '4.2' in yourpackage/__init__.py, have setup.py
do from yourpackage import __version__ and pass that to setup()
2) put __version__ = '4.2' in yourpackage/__init__.py, have setup.py
execfile(os.path.join(os.path.dirname(__file__), 'src', 'yourpackage',
'__init__.py'), d), then use d['__version__']
3) put a file called version.txt in yourpackage/, have setup.py read
it, make sure it's included in MANIFEST.in
4) I don't recall actually ever seeing this one, but it should be
possible to use pkg_resources to query the version of yourpackage
(downside: if you're running from a source checkout without
installing, you won't get the right version number)
Marius Gedminas
--
In order to get a loan you must first prove you don't need it.
signature.asc
Description: Digital signature
_______________________________________________ Distutils-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/distutils-sig
