From: stevenknight Date: Thu, 11 Sep 2008 13:22:12 +0000 (+0000) Subject: Issue 2005: Avoid an infinite loop looking for the Python library X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ed1c232a06e6a4b03811e1b190fe464a1ad1446d;p=scons.git 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. git-svn-id: http://scons.tigris.org/svn/scons/trunk@3386 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/CHANGES.txt b/src/CHANGES.txt index f3a7115d..53d2b244 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 db015493..d8ad7b24 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 75910696..b9629a82 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'.