[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-distutils-sig
Subject:    Re: [Distutils] How to customize egg_info behavior
From:       "Jason R. Coombs" <jaraco () jaraco ! com>
Date:       2010-08-04 4:51:53
Message-ID: 12C7AB425F0DD546B6049311F827C74E08A5E4538C () VA3DIAXVS141 ! RED001 ! local
[Download RAW message or body]

> -----Original Message-----
> From: P.J. Eby [mailto:pje@telecommunity.com]
> 
...
> There isn't any easy way to work around this at the moment (although I
will
> implement a formal fix  in later releases of setuptools).  In the
meantime,
> you can monkeypatch thus, in the same plugin where you implement the
> above function:
> 
>      from setuptools.command.egg_info import egg_info
>      old_tagged_version = egg_info.tagged_version
> 
>      def tagged_version(self):
>          if self.distribution.use_hg_version:
>              return safe_version(self.distribution.get_version())
>          else:
>              return old_tagged_version(self)
> 
>      egg_info.tagged_version = tagged_version
> 
> Whew.  This was a tough one to figure out, and it's a little hacky.
Probably in
> 0.7 I'll just factor this into a separate entry point group for version
> calculations, so that it's not as much trouble to do something like this.
> 

PJE: Thanks again. That's a huge help. I don't think I would have ever
figured out all of those hooks by myself.

One problem I found was that even with that code, the tag_build wasn't
getting set in setup.cfg, so I added another line to set the
egg_info.tag_build in the monkey-patched egg_info.tagged_version. After
that, it seems to work exactly as prescribed.

It's in hgtools 0.4, so feel free to give it a go. As you prescribed, set
use_hg_version=True and setup_requires hgtools>=0.4 and you'll get versions
automatically calculated based on your tags.

Regards,
Jason

["smime.p7s" (application/pkcs7-signature)]

_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig

--===============1474567001==--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic