Skip to content

Commit

Permalink
BUG numpy#1100: fix svn version detection for localized environments.
Browse files Browse the repository at this point in the history
  • Loading branch information
cournape committed Jun 1, 2009
1 parent 83b35de commit 44d92ec
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,23 @@

# Return the svn version as a string, raise a ValueError otherwise
def svn_version():
def _minimal_ext_cmd(cmd):
# construct minimal environment
env = {}
path = os.environ.get('PATH')
if path is not None:
env['PATH'] = path
# LANGUAGE is used on win32
env['LANGUAGE'] = 'C'
env['LANG'] = 'C'
env['LC_ALL'] = 'C'
out = subprocess.Popen(cmd, stdout = subprocess.PIPE, env=env).communicate()[0]
return out

try:
out = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE).communicate()[0]
out = _minimal_ext_cmd(['svn', 'info'])
except OSError:
print " --- Could not run svn info --- "
print(" --- Could not run svn info --- ")
return ""

r = re.compile('Revision: ([0-9]+)')
Expand Down

0 comments on commit 44d92ec

Please sign in to comment.