diff options
author | PJ Eby <distutils-sig@python.org> | 2006-09-17 16:20:47 +0000 |
---|---|---|
committer | PJ Eby <distutils-sig@python.org> | 2006-09-17 16:20:47 +0000 |
commit | 7231e48929b6f4026bb14307185a5837bda115fa (patch) | |
tree | 445db417c6051c8f1ba58fe237c2794261aa59a7 /setuptools/command/egg_info.py | |
parent | a1a8375c3b5b70f52653110a620ab8179d8d7995 (diff) | |
download | external_python_setuptools-7231e48929b6f4026bb14307185a5837bda115fa.tar.gz external_python_setuptools-7231e48929b6f4026bb14307185a5837bda115fa.tar.bz2 external_python_setuptools-7231e48929b6f4026bb14307185a5837bda115fa.zip |
Support svn 1.4 working copy format (backport from trunk)
--HG--
branch : setuptools-0.6
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4051900
Diffstat (limited to 'setuptools/command/egg_info.py')
-rwxr-xr-x | setuptools/command/egg_info.py | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index e1203b9f..eb7aeae2 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -181,10 +181,33 @@ class egg_info(Command): import time; version += time.strftime("-%Y%m%d") return version + + + + + + + + + + + + + + + + + + + + + + def get_svn_revision(self): revision = 0 urlre = re.compile('url="([^"]+)"') revre = re.compile('committed-rev="(\d+)"') + for base,dirs,files in os.walk(os.curdir): if '.svn' not in dirs: dirs[:] = [] @@ -193,16 +216,34 @@ class egg_info(Command): f = open(os.path.join(base,'.svn','entries')) data = f.read() f.close() - dirurl = urlre.search(data).group(1) # get repository URL + + if data.startswith('8'): + data = map(str.splitlines,data.split('\n\x0c\n')) + del data[0][0] # get rid of the '8' + dirurl = data[0][3] + localrev = max([int(d[9]) for d in data if len(d)>9]) + elif data.startswith('<?xml'): + dirurl = urlre.search(data).group(1) # get repository URL + localrev = max([int(m.group(1)) for m in revre.finditer(data)]) + else: + from warnings import warn + warn("unrecognized .svn/entries format; skipping "+base) + dirs[:] = [] + continue if base==os.curdir: base_url = dirurl+'/' # save the root url elif not dirurl.startswith(base_url): dirs[:] = [] continue # not part of the same svn tree, skip it - for match in revre.finditer(data): - revision = max(revision, int(match.group(1))) + revision = max(revision, localrev) + return str(revision or get_pkg_info_revision()) + + + + + def find_sources(self): """Generate SOURCES.txt manifest file""" manifest_filename = os.path.join(self.egg_info,"SOURCES.txt") |