From 9f13cdf6fcf02e50e60d278042be37c0c2b1c7cb Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Thu, 11 Sep 2008 13:22:12 +0000 Subject: Issue 2005: Avoid an infinite loop looking for the Python library directory. Look for a "scons-local" directory in addition to a "scons-local-{version}" directory. --- src/CHANGES.txt | 7 +++++++ src/script/scons.py | 19 ++++++++++--------- src/script/sconsign.py | 19 ++++++++++--------- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index f3a7115..53d2b24 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -19,6 +19,13 @@ RELEASE 1.X - XXX - Fix the ability of the add_src_builder() method to add a new source builder to any other builder. + - Avoid an infinite loop on non-Windows systems trying to find the + SCons library directory if the Python library directory does not + begin with the string "python". + + - Search for the SCons library directory in "scons-local" (with + no version number) after "scons-local-{VERSION}". + From Gary Oberbrunner: - Make Glob() sort the returned list of Files or Nodes diff --git a/src/script/scons.py b/src/script/scons.py index db01549..d8ad7b2 100644 --- a/src/script/scons.py +++ b/src/script/scons.py @@ -66,9 +66,12 @@ libs = [] if os.environ.has_key("SCONS_LIB_DIR"): libs.append(os.environ["SCONS_LIB_DIR"]) -local = 'scons-local-' + __version__ +local_version = 'scons-local-' + __version__ +local = 'scons-local' if script_dir: + local_version = os.path.join(script_dir, local_version) local = os.path.join(script_dir, local) +libs.append(os.path.abspath(local_version)) libs.append(os.path.abspath(local)) scons_version = 'scons-%s' % __version__ @@ -137,14 +140,12 @@ else: except AttributeError: pass else: - while libpath: - libpath, tail = os.path.split(libpath) - if tail[:6] == "python": - break - if libpath: - # Python library is in /usr/libfoo/python*; - # check /usr/libfoo/scons*. - prefs.append(libpath) + # Split /usr/libfoo/python*/os.py to /usr/libfoo/python*. + libpath, tail = os.path.split(libpath) + # Split /usr/libfoo/python* to /usr/libfoo + libpath, tail = os.path.split(libpath) + # Check /usr/libfoo/scons*. + prefs.append(libpath) # Look first for 'scons-__version__' in all of our preference libs, # then for 'scons'. diff --git a/src/script/sconsign.py b/src/script/sconsign.py index 7591069..b9629a8 100644 --- a/src/script/sconsign.py +++ b/src/script/sconsign.py @@ -67,9 +67,12 @@ libs = [] if os.environ.has_key("SCONS_LIB_DIR"): libs.append(os.environ["SCONS_LIB_DIR"]) -local = 'scons-local-' + __version__ +local_version = 'scons-local-' + __version__ +local = 'scons-local' if script_dir: + local_version = os.path.join(script_dir, local_version) local = os.path.join(script_dir, local) +libs.append(os.path.abspath(local_version)) libs.append(os.path.abspath(local)) scons_version = 'scons-%s' % __version__ @@ -138,14 +141,12 @@ else: except AttributeError: pass else: - while libpath: - libpath, tail = os.path.split(libpath) - if tail[:6] == "python": - break - if libpath: - # Python library is in /usr/libfoo/python*; - # check /usr/libfoo/scons*. - prefs.append(libpath) + # Split /usr/libfoo/python*/os.py to /usr/libfoo/python*. + libpath, tail = os.path.split(libpath) + # Split /usr/libfoo/python* to /usr/libfoo + libpath, tail = os.path.split(libpath) + # Check /usr/libfoo/scons*. + prefs.append(libpath) # Look first for 'scons-__version__' in all of our preference libs, # then for 'scons'. -- cgit v0.12