On Tue, 2010-05-25 at 13:09 -0400, P.J. Eby wrote:
At 05:58 PM 5/25/2010 +0200, Ronny Pfannschmidt wrote:
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.
I don't just use the dev/build tag.
I use a completely vcs based approach to releasing, which means the complete version is inferred from the vcs (not just the tag)
Being at a revision that's tagged with a version number means i can skip the dev marker, anything else means i infer it via the distance in commits to the last version number tag + add the commit node id.
Would storing the complete version in the build tag and passing setup.py a empty version string be a reasonable enough approach?
On a side-note, i don't use svn for any of my projects, its hg for most of them.