Don't die if we can't execute the Solaris packaging utilities, so the
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 2 Aug 2009 21:10:14 +0000 (21:10 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 2 Aug 2009 21:10:14 +0000 (21:10 +0000)
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

src/engine/SCons/Tool/sunc++.py

index 8c8e1f15e71a7edc9527e3784d5eb46f8bd9cbb4..164551cab4bb931aedff145c0362af87da0676f4 100644 (file)
@@ -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]