setuptools and Subversion 1.5
Heads up: if you do not patch setuptools, installs from svn working copies *will* error out when you upgrade to Subversion 1.5. This isn't a big deal, really. If you're not using the new features, you can easily downgrade your working copy (left as an exercise for the reader, since I don't want to empower that kind of bad behavior). That said, if you are like me, you want to just fix setuptools. I figured out the patch. It's actually trivial, since they are already parsing the entries file in a sane way, all that needed to happen was to bump the accepted version of the entries file in the setuptools sources and move on with my day. Unfortunately, they have been totally silent on the patch. As such, I'm posting it here so that Google at least has a chance of finding this and making the world able to fix this problem. Here's the patch:
If this works for you (and you are sure you are using svn 1.5 client binaries ("head -n 1 .svn/entries" prints "9"), please head over to the distutils SIG list and mention that it works for you. Of course, if you're reading this and you can be more of an authority than I can (I read the the libsvn_wc docs (search "The entries file")), please comment over there if the patch is right, or give me feedback so I can submit a more resilient patch.
Index: setuptools/command/egg_info.py
===================================================================
--- setuptools/command/egg_info.py (revision 61076)
+++ setuptools/command/egg_info.py (working copy)
@@ -217,9 +217,9 @@
data = f.read()
f.close()
- if data.startswith('8'):
+ if data.startswith('8') or data.startswith('9'):
data = map(str.splitlines,data.split('\n\x0c\n'))
- del data[0][0] # get rid of the '8'
+ del data[0][0] # get rid of the '8' or '9'
dirurl = data[0][3]
localrev = max([int(d[9]) for d in data if len(d)>9 and d[9]]+[0])
elif data.startswith('<?xml'):
Index: setuptools/command/sdist.py
===================================================================
--- setuptools/command/sdist.py (revision 61076)
+++ setuptools/command/sdist.py (working copy)
@@ -86,7 +86,7 @@
f = open(filename,'rU')
data = f.read()
f.close()
- if data.startswith('8'): # subversion 1.4
+ if data.startswith('8') or data.startswith('9'): # subversion 1.4 or 1.5
for record in map(str.splitlines, data.split('\n\x0c\n')[1:]):
if not record or len(record)>=6 and record[5]=="delete":
continue # skip deleted
If this works for you (and you are sure you are using svn 1.5 client binaries ("head -n 1 .svn/entries" prints "9"), please head over to the distutils SIG list and mention that it works for you. Of course, if you're reading this and you can be more of an authority than I can (I read the the libsvn_wc docs (search "The entries file")), please comment over there if the patch is right, or give me feedback so I can submit a more resilient patch.
2 Comments:
Hey,
The patch works for me! Thanks for that. My buildout's started to complain about a logger not being available after updating to svn 1.5. So there is also a bug in sdist.py that tries to use an unimported logger.
Would it be possible to apply the patches ourselves and put it on pypi? More people are going to run into this for sure.
Also for people using virtualenv in combination with zc.buildout. Virtualenv installs its own setuptools. So what I've done is applied the patch to my machine wide setuptools and delete the setuptools automatically in my virtualenv bootstrap. This in combination with allowing virtualenv to use the machine site-packages ensures you always use the patched one.
Cheers,
Remco
hmm, why not just:
if int(data[0]) >= 8:
...
then just wait for some future version of svn to break the format (unlikely) otherwise new versions of svn should be supported without a patch.
Post a Comment
<< Home