Revision: 6376
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6376&view=rev
Author:   efiring
Date:     2008-11-08 18:33:01 +0000 (Sat, 08 Nov 2008)

Log Message:
-----------
Improve error reporting when pygtk or gtk+ headers are missing.

Modified Paths:
--------------
    trunk/matplotlib/setupext.py

Modified: trunk/matplotlib/setupext.py
===================================================================
--- trunk/matplotlib/setupext.py        2008-11-08 17:08:25 UTC (rev 6375)
+++ trunk/matplotlib/setupext.py        2008-11-08 18:33:01 UTC (rev 6376)
@@ -235,7 +235,8 @@
 def get_pkgconfig(module,
                   packages,
                   flags="--libs --cflags",
-                  pkg_config_exec='pkg-config'):
+                  pkg_config_exec='pkg-config',
+                  report_error=False):
     """Loosely based on an article in the Python Cookbook:
     http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502261""";
     if not has_pkgconfig():
@@ -247,8 +248,8 @@
               '-D': 'define_macros',
               '-U': 'undef_macros'}
 
-    status, output = commands.getstatusoutput(
-        "%s %s %s" % (pkg_config_exec, flags, packages))
+    cmd = "%s %s %s" % (pkg_config_exec, flags, packages)
+    status, output = commands.getstatusoutput(cmd)
     if status == 0:
         for token in output.split():
             attr = _flags.get(token[:2], None)
@@ -266,6 +267,9 @@
                 if token not in module.extra_link_args:
                     module.extra_link_args.append(token)
         return True
+    if report_error:
+        print_status("pkg-config", "looking for %s" % packages)
+        print_message(output)
     return False
 
 def get_pkgconfig_version(package):
@@ -642,6 +646,7 @@
             explanation = (
                 "Could not find Gtk+ headers in any of %s" %
                 ", ".join(["'%s'" % x for x in module.include_dirs]))
+            gotit = False
 
     def ver2str(tup):
         return ".".join([str(x) for x in tup])
@@ -718,8 +723,10 @@
     if sys.platform != 'win32':
         # If Gtk+ is installed, pkg-config is required to be installed
         add_base_flags(module)
-        get_pkgconfig(module, 'pygtk-2.0 gtk+-2.0')
-
+        ok = get_pkgconfig(module, 'pygtk-2.0 gtk+-2.0', report_error=True)
+        if not ok:
+            print_message(
+                "You may need to install 'dev' package(s) to provide header 
files.")
     # visual studio doesn't need the math library
     if sys.platform == 'win32' and win32_compiler == 'msvc' and 'm' in 
module.libraries:
         module.libraries.remove('m')


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to