diff options
author | Dan Crosta <dcrosta@10gen.com> | 2012-02-03 18:39:54 -0500 |
---|---|---|
committer | Dan Crosta <dcrosta@10gen.com> | 2012-02-03 18:39:54 -0500 |
commit | 2d4f7f4c88b0bce3e96f1098b6d2eecce448388e (patch) | |
tree | 7511c31eeff093fe68e79ff4a5dcbad5af9e72ce | |
parent | 3885acaf7a1eb9509c0cc3b12a9c54a259c973f5 (diff) | |
download | mongo-2d4f7f4c88b0bce3e96f1098b6d2eecce448388e.tar.gz |
correct version number comparison
-rw-r--r-- | SConstruct | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/SConstruct b/SConstruct index 504fd9d89b9..55d234343fc 100644 --- a/SConstruct +++ b/SConstruct @@ -823,17 +823,19 @@ def smoke_python_name(): # which we assume to be installed. import subprocess version = re.compile(r'[Pp]ython ([\d\.]+)', re.MULTILINE) - binaries = ['python', 'python2.5', 'python2.6', 'python2.7', 'python25', 'python26', 'python27'] + binaries = ['python2.5', 'python2.6', 'python2.7', 'python25', 'python26', 'python27', 'python'] for binary in binaries: try: # py-2.4 compatible replacement for shell backticks - output = subprocess.Popen([binary, '-V'], stdout=subprocess.PIPE).communicate()[0] - match = version.search(output) - if match and float(match.group(1)) >= 2.5: - return binary + out, err = subprocess.Popen([binary, '-V'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() + for stream in (out, err): + match = version.search(stream) + if match: + versiontuple = tuple(map(int, match.group(1).split('.'))) + if versiontuple >= (2, 5): + return binary except: pass - # if that all fails, fall back to "python" return "python" |