From 434d43411eae45577bff2b9ea4b2ca85d29cd393 Mon Sep 17 00:00:00 2001 From: bdbaddog Date: Tue, 10 Nov 2009 06:49:02 +0000 Subject: [PATCH] Add check for python 3.0.0 or higher and exit with message. Resolve bug 2445 git-svn-id: http://scons.tigris.org/svn/scons/trunk@4380 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/CHANGES.txt | 3 +++ src/RELEASE.txt | 2 +- src/script/scons.py | 13 +++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 0039c325..6c16a4a1 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -25,6 +25,9 @@ RELEASE X.X.X - XXX Compilers. This will be rolled out to other platforms/tools in the future. + - Add check for python >= 3.0.0 and exit gracefully. + For 1.3 python >= 1.5.2 and < 3.0.0 are supported + From Lukas Erlinghagen: - Have AddOption() remove variables from the list of diff --git a/src/RELEASE.txt b/src/RELEASE.txt index 5691dd70..8050c034 100644 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -34,7 +34,7 @@ RELEASE 1.2.0.d20090223 - Mon, 23 Feb 2009 08:41:06 -0800 features will still be supported in 1.3.0 but will generate mandatory, non-disableable warnings: - -- Support for Python versions 1.5, 1.6, 2.0 and 2.1. + -- Support for Python versions 1.5, 1.6, 2.0, 2.1, 2.2 and 2.3. -- The overrides= keyword argument to the Builder() call. -- The scanner= keyword argument to the Builder() call. -- The BuildDir() function and env.BuildDir() method. diff --git a/src/script/scons.py b/src/script/scons.py index 94ecccb2..fb4cf525 100644 --- a/src/script/scons.py +++ b/src/script/scons.py @@ -56,6 +56,19 @@ import sys # followed by generic) so we pick up the right version of the build # engine modules if they're in either directory. + +# Check to see if the python version is > 3.0 which is currently unsupported +# If so exit with error message +try: + if sys.version_info >= (3,0,0): + msg = "scons: *** SCons version %s does not run under Python version %s.\n" + sys.stderr.write(msg % (__version__, sys.version.split()[0])) + sys.exit(1) +except AttributeError: + # Pre-1.6 Python has no sys.version_info + # No need to check version as we then know the version is < 3.0.0 and supported + pass + script_dir = sys.path[0] if script_dir in sys.path: -- 2.26.2