From b5865923694a2d293318b7eecaeba1d6ba6be0b8 Mon Sep 17 00:00:00 2001 From: GregNoel Date: Fri, 26 Sep 2008 18:48:37 +0000 Subject: [PATCH] Revert checkin of incomplete change git-svn-id: http://scons.tigris.org/svn/scons/trunk@3491 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/engine/SCons/Tool/sunc++.py | 44 ++++++++++----------------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/src/engine/SCons/Tool/sunc++.py b/src/engine/SCons/Tool/sunc++.py index 2392f266..7ef3e023 100644 --- a/src/engine/SCons/Tool/sunc++.py +++ b/src/engine/SCons/Tool/sunc++.py @@ -34,12 +34,8 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons -subproc = SCons.Action._subproc -import os -import re -import subprocess -PIPE = subprocess.PIPE +import os.path cplusplus = __import__('c++', globals(), locals(), []) @@ -59,33 +55,19 @@ 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" % (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 + 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 path, version = look_pkg_db() if path and version: -- 2.26.2