Revision: 7953
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7953&view=rev
Author:   jouni
Date:     2009-11-12 17:28:22 +0000 (Thu, 12 Nov 2009)

Log Message:
-----------
Fix EINTR problem in font_manager.py

Modified Paths:
--------------
    trunk/matplotlib/CHANGELOG
    trunk/matplotlib/lib/matplotlib/font_manager.py

Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG  2009-11-12 17:27:34 UTC (rev 7952)
+++ trunk/matplotlib/CHANGELOG  2009-11-12 17:28:22 UTC (rev 7953)
@@ -1,3 +1,8 @@
+2009-11-12 font_manager.py should no longer cause EINTR on Python 2.6
+           (but will on the 2.5 version of subprocess). Also the
+           fc-list command in that file was fixed so now it should
+           actually find the list of fontconfig fonts. - JKS
+
 2009-11-10 Single images, and all images in renderers with
            option_image_nocomposite (i.e. agg, macosx and the svg
            backend when rcParams['svg.image_noscale'] is True), are

Modified: trunk/matplotlib/lib/matplotlib/font_manager.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/font_manager.py     2009-11-12 17:27:34 UTC 
(rev 7952)
+++ trunk/matplotlib/lib/matplotlib/font_manager.py     2009-11-12 17:28:22 UTC 
(rev 7953)
@@ -42,7 +42,7 @@
             see license/LICENSE_TTFQUERY.
 """
 
-import os, sys, glob
+import os, sys, glob, subprocess
 try:
     set
 except NameError:
@@ -292,16 +292,12 @@
     grab all of the fonts the user wants to be made available to
     applications, without needing knowing where all of them reside.
     """
-    try:
-        import commands
-    except ImportError:
-        return {}
-
     fontext = get_fontext_synonyms(fontext)
 
     fontfiles = {}
-    status, output = commands.getstatusoutput("fc-list file")
-    if status == 0:
+    pipe = subprocess.Popen(['fc-list', '', 'file'], stdout=subprocess.PIPE)
+    output = pipe.communicate()[0]
+    if pipe.returncode == 0:
         for line in output.split('\n'):
             fname = line.split(':')[0]
             if (os.path.splitext(fname)[1][1:] in fontext and
@@ -1244,11 +1240,11 @@
     import re
 
     def fc_match(pattern, fontext):
-        import commands
         fontexts = get_fontext_synonyms(fontext)
         ext = "." + fontext
-        status, output = commands.getstatusoutput('fc-match -sv "%s"' % 
pattern)
-        if status == 0:
+        pipe = subprocess.Popen(['fc-match', '-sv', pattern], 
stdout=subprocess.PIPE)
+        output = pipe.communicate()[0]
+        if pipe.returncode == 0:
             for match in _fc_match_regex.finditer(output):
                 file = match.group(1)
                 if os.path.splitext(file)[1][1:] in fontexts:


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

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to