[openbiblio-dev] Mercurial Dependencies for Version info in Python Packages
William Waites
william.waites at okfn.org
Tue Jul 6 16:14:57 UTC 2010
This just came up on IRC, Rufus suggested bringing it up
on the list.
In the ordf/ontosrv/openbiblio python packages, I've
introduced an optional dependency on mercurial so that
package version numbers can be made automatically:
version = '0.5'
try:
from mercurial import ui, hg, error
repo = hg.repository(ui.ui(), ".")
ver = repo[version]
except ImportError:
pass
except error.RepoLookupError:
tip = repo["tip"]
version = version + ".%s.%s" % (tip.rev(), tip.hex()[:12])
This makes pretty version numbers as in,
Finished processing dependencies for ordf==0.5.201.269ac7b7537a
If there's a tag for the current version it will use that (so no
minor version, changeset hash)
Is this a terrible idea?
Cheers,
-w
--
William Waites <william.waites at okfn.org>
Mob: +44 789 798 9965 Open Knowledge Foundation
Fax: +44 131 464 4948 Edinburgh, UK
RDF Indexing, Clustering and Inferencing in Python
http://ordf.org/
More information about the openbiblio-dev
mailing list