Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r64663:a66a2e966de1
Date: 2013-05-29 12:09 +0200
http://bitbucket.org/pypy/pypy/changeset/a66a2e966de1/

Log:    Test and fix for from_pkg_config().

diff --git a/rpython/translator/tool/cbuild.py 
b/rpython/translator/tool/cbuild.py
--- a/rpython/translator/tool/cbuild.py
+++ b/rpython/translator/tool/cbuild.py
@@ -164,8 +164,11 @@
         """Returns a new ExternalCompilationInfo instance by executing
         'pkg-config <pkgname>' with --cflags and --libs arguments."""
         assert isinstance(pkgname, str)
-        popen = subprocess.Popen(['pkg-config', pkgname, '--exists'])
-        result = popen.wait()
+        try:
+            popen = subprocess.Popen(['pkg-config', pkgname, '--exists'])
+            result = popen.wait()
+        except OSError:
+            result = -1
         if result != 0:
             raise ImportError("failed: 'pkg-config %s --exists'" % pkgname)
         return cls._run_config_tool('pkg-config "%s"' % pkgname)
diff --git a/rpython/translator/tool/test/test_cbuild.py 
b/rpython/translator/tool/test/test_cbuild.py
--- a/rpython/translator/tool/test/test_cbuild.py
+++ b/rpython/translator/tool/test/test_cbuild.py
@@ -127,6 +127,18 @@
                        ExternalCompilationInfo.from_config_tool,
                        'dxowqbncpqympqhe-config')
 
+    def test_from_pkg_config(self):
+        try:
+            cmd = ['pkg-config', 'ncurses', '--exists']
+            popen = Popen(cmd)
+            result = popen.wait()
+        except OSError:
+            result = -1
+        if result != 0:
+            py.test.skip("failed: %r" % (' '.join(cmd),))
+        eci = ExternalCompilationInfo.from_pkg_config('ncurses')
+        assert 'ncurses' in eci.libraries
+
     def test_platforms(self):
         from rpython.translator.platform import Platform
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to