[Distutils] setuptools --tag-revision poposed feature

Phillip J. Eby pje at telecommunity.com
Mon May 3 06:23:03 CEST 2010

At 09:35 AM 5/2/2010, Manlio Perillo wrote:
>Currently setuptools only support a ``tag-svn-revision`` option.
>However I use Mercurial, and I would like to tag hg revisions.
>Looking at setuptool sources, it should not hard to add a new
>``tag-revision`` option, used, as an example:
>   --tag-revision=hg
>In egg_info command class, then, the tags method could do something like:
>     def tags(self):
>         version = ''
>         if self.tag_build:
>             version+=self.tag_build
>         if self.tag_revision:
>             for ep in iter_entry_points(
>                 'setuptools.tag_revision', self.tag_revision):
>                 version += '-r%s' % ep.load()()
>                 # Only use first entry point
>                 break

This won't work correctly unless you have only one such plugin 
installed, so the feature needs to be explicitly configured for one 
specific plugin.

>         elif os.path.exists('PKG-INFO'):
>             version += '-r%s' % get_pkg_info_revision()
>         if self.tag_date:
>             import time; version += time.strftime("-%Y%m%d")
>         return version
>The current ``--tag-svn-revision`` will become an alias for
>``--tag-revision=svn``, and support will be directly available in
>I don't know if setuptools is still under development (this topic seems
>quite confused, for me), but can I write a patch, hoping that it will be
>Where should I send the patch?

Attach it to this outstanding feature request:


As you'll see, there's been some previous discussion for this, and I 
do plan to make pluggable revision support available in 0.7.  It will 
probably be similar to the most recent patch attached to that issue, 
with a change to the option name and a few other tweaks.

More information about the Distutils-SIG mailing list