[Distutils] on storing vcs version infos in sdists

P.J. Eby pje at telecommunity.com
Tue May 25 19:09:34 CEST 2010


At 05:58 PM 5/25/2010 +0200, Ronny Pfannschmidt wrote:
>hi,
>
>whats a good place to store version information from a vcs in a sdist,
>without needing to drop them into python files.
>
>i wrote a simple module that gets me version meta-data from hg
>repos/archives,
>using the same algorithms hg is using for its own version number
>generation.
>
>The nit in that is that i have to store it in a python file.
>I'd much rather put it somewhere else in case of sdists,
>but i have no idea where/how i should put it to fit with the
>setuptools/distribute standards.

Setuptools stores this information in the setup.cfg of an sdist, under:

[egg_info]
tag_build = .dev-r#####

More precisely, what it does is take whatever was in tag_build before 
(either from setup.cfg or the command line) and then tack the 
revision info on the end, and stick it into the sdist's setup.cfg, 
with tag_svn_revision turned back off.

So in the above example, if tag_build was originally .dev, then the 
-r#### bit got added on.  If tag_build was empty, then it would've 
been just '-r####'.

Anyway, if you store it in setup.cfg, then it will automatically get 
tacked on the end of the version specified in setup.py, and it will 
get used by all the version/dependency APIs, such as querying 
pkg_resources for a particular version of a project, or requesting a 
project's version.



More information about the Distutils-SIG mailing list