[Distutils] EasyInstall: svn support

Ian Bicking ianb at colorstudy.com
Mon May 30 02:40:14 CEST 2005

Phillip J. Eby wrote:
>> Well, at least for my own packages I'll try to make the version 
>> better, by dynamically generating it in setup.py;
> Note that it needs to be robust if the build machine doesn't have svn.

Yeah... I'm not sure what that needs to do.  For release branches I'll 
comment or otherwise disable that code, since the whole point of a 
release is to avoid svn-anything.  If it's not a release, then I'm not 
sure how they'd acquire it without svn.  If I set up something to get a 
snapshot, then I'll have to be sure to add that svn metadata somewhere 
to the snapshot, and that will make the svn access unnecessary.

>>> It indeed doesn't do anything; you'd be better off munging the 
>>> setup.py to change the setup version.
>>> Maybe what I can do is have the build stuff look for a .svn dir in 
>>> the build area, and if one is present, grab the revision and add it 
>>> to the end of the version string supplied to setup().  Or simpler 
>>> still, I could add a '--tag-svn-revision' option to bdist_egg, that 
>>> would make *it* do that.  I've been thinking it would be nice to have 
>>> a '--tag-build=NUMBER' or '--tag-date' option for bdist_egg anyway, 
>>> to support daily builds and such.  So adding an option to "get the 
>>> tag value from 'svn info'" would just be a minor variation on the theme.
>> Yes, that would work well.
> I've decided I don't want this to happen automatically for EasyInstall 
> egg builds, though.    If I later let you pass build options through to 
> the setup.py, you'll be able to do it that way.  I just don't think it 
> should invoke --tag-svn-revision by default.  For one thing, I don't 
> have a way to know if subversion is installed, and you could've 
> downloaded a source .zip with .svn dirs accidentally included.  (I've 
> seen this from time to time with CVS dirs.)

Well, one way is to have _download_svn() put that metadata into the 
downloaded files -- some special file -- to later be read by setuptools. 
  That would fit into a downloadable snapshot as well.  And obviously 
_download_svn() can't work without svn installed.  It should also be 
reasonably easy to translate to other version control systems, insofar 
as they have useful revision numbers.  Though I don't think many of the 
distributed systems do :(  Unless you are okay with *really* long 
versions that essentially embed a UUID -- but I don't encounter any of 
those repositories, so it's not a problem for me yet.

>>   And technically file: should work for svn too, which I suppose you 
>> could detect because it points to a directory with a db/fs-type file.  
>> Eh, those can wait.
> I'd need more details before I could implement that.

It's pretty low priority.  I can look into it at some point, but it's 
only useful for the uncommon case where people are doing development on 
their own machine from a private repository, and want to test the process.

> In the meantime, I'm going to go ahead and build/upload an 
> EasyInstall/setuptools-0.3a2 release with the new subversion support, 
> revision tagging, and bug fixes.  Thanks for your help!

Cool, I'll clear out the old one and start again with the new.

Ian Bicking  /  ianb at colorstudy.com  / http://blog.ianbicking.org

More information about the Distutils-SIG mailing list