summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-08-29 04:39:46 (GMT)
committerSteven Knight <knight@baldmt.com>2003-08-29 04:39:46 (GMT)
commite7bd1d71888221071e97778d1dbd31750d9874cd (patch)
treebe754e403c1f1c2868c9a1a71091108d543b8176 /src
parent2980620964ae712daafc70b7a715351dddbc54ba (diff)
downloadSCons-e7bd1d71888221071e97778d1dbd31750d9874cd.zip
SCons-e7bd1d71888221071e97778d1dbd31750d9874cd.tar.gz
SCons-e7bd1d71888221071e97778d1dbd31750d9874cd.tar.bz2
Fix EnsurePythonVersion's handling of alphanumeric version strings.
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt2
-rw-r--r--src/engine/SCons/Script/SConscript.py12
2 files changed, 11 insertions, 3 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 0b1b03e..3aad3c1 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -28,6 +28,8 @@ RELEASE X.XX - XXX
- Support #include when there's no space before the opening quote
or angle bracket.
+ - Accomodate alphanumeric version strings in EnsurePythonVersion().
+
RELEASE 0.92 - Wed, 20 Aug 2003 03:45:28 -0500
diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py
index ee53a63..0f9daa7 100644
--- a/src/engine/SCons/Script/SConscript.py
+++ b/src/engine/SCons/Script/SConscript.py
@@ -49,6 +49,7 @@ import SCons.Node.Alias
import os
import os.path
+import re
import string
import sys
import traceback
@@ -453,11 +454,16 @@ class Options(SCons.Options.Options):
def __init__(self, files=None, args=arguments):
SCons.Options.Options.__init__(self, files, args)
-def CheckVersion(major,minor,version_string):
+def CheckVersion(major, minor, version_string):
"""Return 0 if 'major' and 'minor' are greater than the version
in 'version_string', and 1 otherwise."""
- version = string.split(string.split(version_string, ' ')[0], '.')
- if major > int(version[0]) or (major == int(version[0]) and minor > int(version[1])):
+ try:
+ v_major, v_minor, v_micro, release, serial = sys.version_info
+ except AttributeError:
+ version = string.split(string.split(version_string, ' ')[0], '.')
+ v_major = int(version[0])
+ v_minor = int(re.match('\d+', version[1]).group())
+ if major > v_major or (major == v_major and minor > v_minor):
return 0
else:
return 1