From 0c39ec94423bda77dc46dc6c82294cdfd7447f89 Mon Sep 17 00:00:00 2001 From: Philip Thiem Date: Fri, 5 Jul 2013 10:37:42 -0500 Subject: fixed some issues with OSError have to emulate zipfile extract on py2.5 and earlier for tests --HG-- extra : rebase_source : c6ad4eab19a2a454b8b8043d88d9582168f617aa --- setuptools/svn_utils.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'setuptools/svn_utils.py') diff --git a/setuptools/svn_utils.py b/setuptools/svn_utils.py index 10c5861d..932ee75c 100644 --- a/setuptools/svn_utils.py +++ b/setuptools/svn_utils.py @@ -34,10 +34,14 @@ _SVN_VER_RE = re.compile(r'(?:(\d+):)?(\d+)([a-z]*)\s*$', re.I) # python-subprocess-popen-environment-path def _run_command(args, stdout=_PIPE, stderr=_PIPE): #regarding the shell argument, see: http://bugs.python.org/issue8557 - proc = _Popen(args, stdout=stdout, stderr=stderr, - shell=(sys.platform == 'win32')) + try: + proc = _Popen(args, stdout=stdout, stderr=stderr, + shell=(sys.platform == 'win32')) + + data = proc.communicate()[0] + except OSError: + return 1, '' - data = proc.communicate()[0] #TODO: this is probably NOT always utf-8 try: data = unicode(data, encoding='utf-8') @@ -60,11 +64,13 @@ def _get_entry_schedule(entry): def parse_revision(path): - code, data = _run_command(['svnversion', path]) + code, data = _run_command(['svnversion', '-c', path]) if code: log.warn("svnversion failed") - return [] + return 0 + else: + log.warn('Version: %s' % data.strip()) parsed = _SVN_VER_RE.match(data) if parsed: -- cgit v1.2.1