From: stevenknight Date: Sun, 2 Aug 2009 21:10:14 +0000 (+0000) Subject: Don't die if we can't execute the Solaris packaging utilities, so the X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2b75f0349904f6090befefddbf0dc3cef57a0d6c;p=scons.git 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. git-svn-id: http://scons.tigris.org/svn/scons/trunk@4317 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/engine/SCons/Tool/sunc++.py b/src/engine/SCons/Tool/sunc++.py index 8c8e1f15..164551ca 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]