diff options
author | Steven Knight <knight@baldmt.com> | 2009-08-02 21:10:14 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2009-08-02 21:10:14 (GMT) |
commit | 2b91edeeb2f568f92036ff31190080732231c6e7 (patch) | |
tree | 592f83cce56781a20ce0d07df4dbf649b8a42dbb /src/engine/SCons/Tool/sunc++.py | |
parent | 4bce55bf34b74d453971af4bccaeba1355d052e0 (diff) | |
download | SCons-2b91edeeb2f568f92036ff31190080732231c6e7.zip SCons-2b91edeeb2f568f92036ff31190080732231c6e7.tar.gz SCons-2b91edeeb2f568f92036ff31190080732231c6e7.tar.bz2 |
Don't die if we can't execute the Solaris packaging utilities, so the
sunc++.py module will import okay (for testing, etc.) on non-Solaris
systems.
Diffstat (limited to 'src/engine/SCons/Tool/sunc++.py')
-rw-r--r-- | src/engine/SCons/Tool/sunc++.py | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/src/engine/SCons/Tool/sunc++.py b/src/engine/SCons/Tool/sunc++.py index 8c8e1f1..164551c 100644 --- a/src/engine/SCons/Tool/sunc++.py +++ b/src/engine/SCons/Tool/sunc++.py @@ -59,24 +59,32 @@ def get_package_info(package_name, pkginfo, pkgchk): if sadm_match: pathname = sadm_match.group(1) - p = subprocess.Popen([pkginfo, '-l', package_name], - stdout=subprocess.PIPE, - stderr=open('/dev/null', 'w')) - pkginfo_contents = p.communicate()[0] - version_re = re.compile('^ *VERSION:\s*(.*)$', re.M) - version_match = version_re.search(pkginfo_contents) - if version_match: - version = version_match.group(1) - - if pathname is None: - p = subprocess.Popen([pkgchk, '-l', package_name], + try: + p = subprocess.Popen([pkginfo, '-l', package_name], stdout=subprocess.PIPE, stderr=open('/dev/null', 'w')) - pkgchk_contents = p.communicate()[0] - pathname_re = re.compile(r'^Pathname:\s*(.*/bin/CC)$', re.M) - pathname_match = pathname_re.search(pkgchk_contents) - if pathname_match: - pathname = pathname_match.group(1) + except EnvironmentError: + pass + else: + pkginfo_contents = p.communicate()[0] + version_re = re.compile('^ *VERSION:\s*(.*)$', re.M) + version_match = version_re.search(pkginfo_contents) + if version_match: + version = version_match.group(1) + + if pathname is None: + try: + p = subprocess.Popen([pkgchk, '-l', package_name], + stdout=subprocess.PIPE, + stderr=open('/dev/null', 'w')) + except EnvironmentError: + pass + else: + pkgchk_contents = p.communicate()[0] + pathname_re = re.compile(r'^Pathname:\s*(.*/bin/CC)$', re.M) + pathname_match = pathname_re.search(pkgchk_contents) + if pathname_match: + pathname = pathname_match.group(1) package_info[package_name] = (version, pathname) return package_info[package_name] |