From add43dc2455817fc88ac124f397c1f57447c587c Mon Sep 17 00:00:00 2001 From: GregNoel Date: Fri, 26 Sep 2008 18:31:20 +0000 Subject: [PATCH] reassign credit where credit is due git-svn-id: http://scons.tigris.org/svn/scons/trunk@3490 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/CHANGES.txt | 19 ++++++++++---- src/engine/SCons/Tool/sunc++.py | 46 +++++++++++++++++++++++---------- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 4f6bcf52..2e338893 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -10,6 +10,11 @@ RELEASE 1.X - XXX + From Chris AtLee + + - Use the specified environment when checking for the GCC compiler + version. + From Ian P. Cardenas: - Fix Glob() polluting LIBPATH by returning copy of list @@ -19,6 +24,9 @@ RELEASE 1.X - XXX - Add CheckCC, CheckCXX, CheckSHCC and CheckSHCXX tests to configuration contexts. + - Have the --profile= argument use the much faster cProfile module + (if it's available in the running Python version). + - Reorder MSVC compilation arguments so the /Fo is first. From Bill Deegan: @@ -30,6 +38,10 @@ RELEASE 1.X - XXX - When scanning for a #include file, don't use a directory that has the same name as the file. + From Ralf W. Grosse-Kunstleve + + - Suppress error output when checking for the GCC compiler version. + From Jared Grubb: - Fix VariantDir duplication of #included files in subdirectories. @@ -87,11 +99,8 @@ RELEASE 1.X - XXX - Fix typos and format bugs in the man page. - - Have the --profile= argument use the much faster cProfile module - (if it's available in the running Python version). - - - Use the specified environment and suppress error output when - checking for the gcc compiler version. + - Add a first draft of a wrapper module for Python's subprocess + module. - Refactor use of the SCons.compat module so other modules don't have to import it individually. diff --git a/src/engine/SCons/Tool/sunc++.py b/src/engine/SCons/Tool/sunc++.py index 95b45168..2392f266 100644 --- a/src/engine/SCons/Tool/sunc++.py +++ b/src/engine/SCons/Tool/sunc++.py @@ -33,9 +33,13 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import SCons.Util +import SCons +subproc = SCons.Action._subproc -import os.path +import os +import re +import subprocess +PIPE = subprocess.PIPE cplusplus = __import__('c++', globals(), locals(), []) @@ -55,19 +59,33 @@ def get_cppc(env): def look_pkg_db(pkginfo=pkginfo, pkgchk=pkgchk): version = None - path = None for package in ['SPROcpl']: - cmd = "%s -l %s 2>/dev/null | grep '^ *VERSION:'" % (pkginfo, package) - line = os.popen(cmd).readline() - if line: - version = line.split()[-1] - cmd = "%s -l %s 2>/dev/null | grep '^Pathname:.*/bin/CC$' | grep -v '/SC[0-9]*\.[0-9]*/'" % (pkgchk, package) - line = os.popen(cmd).readline() - if line: - path = os.path.dirname(line.split()[-1]) - break - - return path, version + #cmd = "%s -l %s 2>/dev/null" % (pkginfo, package) + cmd = [pkginfo, '-l', package] + c = subproc(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True) + lines,err = c.communicate() + if c.wait(): continue + for line in string.split(lines, '\n'): + # grep '^ *VERSION:' + line = string.strip(line) + if line[:8] == 'VERSION:': break + else: + continue + version = string.split(line)[-1] + #cmd = "%s -l %s 2>/dev/null" % (pkgchk, package) + cmd = [pkgchk, '-l', package] + c = subproc(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True) + lines,err = c.communicate() + if c.wait(): continue + for line in string.split(lines, '\n'): + # grep '^Pathname:.*/bin/CC$' + if line[:9] != 'Pathname:': continue + if line[-7:] != '/bin/CC': continue + # grep -v '/SC[0-9]*\.[0-9]*/' + if re.search(r'/SC[0-9]*\.[0-9]*/', line): continue + return os.path.dirname(string.split(line)[-1]), version + + return None, version path, version = look_pkg_db() if path and version: -- 2.26.2