[python-matplotlib] Decode output of subprocess to utf-8 or regex will fail (#928326)

tomspur tomspur at fedoraproject.org
Wed Apr 3 00:24:55 UTC 2013


commit 83a27676aab89f926447bb4e25a6375db09fa4d1
Author: Thomas Spura <thomas.spura at gmail.com>
Date:   Wed Apr 3 02:24:20 2013 +0200

    Decode output of subprocess to utf-8 or regex will fail (#928326)

 python-matplotlib-fontconfig.patch |   38 ++++++++++++++++++------------------
 python-matplotlib.spec             |    5 +++-
 2 files changed, 23 insertions(+), 20 deletions(-)
---
diff --git a/python-matplotlib-fontconfig.patch b/python-matplotlib-fontconfig.patch
index c6ad339..d9318e5 100644
--- a/python-matplotlib-fontconfig.patch
+++ b/python-matplotlib-fontconfig.patch
@@ -1,7 +1,7 @@
-diff -up matplotlib-1.2.0/lib/matplotlib/font_manager.py.orig matplotlib-1.2.0/lib/matplotlib/font_manager.py
---- matplotlib-1.2.0/lib/matplotlib/font_manager.py.orig	2013-02-24 22:50:54.932678576 -0300
-+++ matplotlib-1.2.0/lib/matplotlib/font_manager.py	2013-02-24 22:54:29.627686797 -0300
-@@ -62,7 +62,7 @@ try:
+diff -ur matplotlib-1.2.0.orig/lib/matplotlib/font_manager.py matplotlib-1.2.0/lib/matplotlib/font_manager.py
+--- matplotlib-1.2.0.orig/lib/matplotlib/font_manager.py	2012-10-31 01:11:14.000000000 +0100
++++ matplotlib-1.2.0/lib/matplotlib/font_manager.py	2013-04-03 01:50:34.433802284 +0200
+@@ -62,7 +62,7 @@
  except ImportError:
      import pickle
  
@@ -10,7 +10,7 @@ diff -up matplotlib-1.2.0/lib/matplotlib/font_manager.py.orig matplotlib-1.2.0/l
  
  verbose = matplotlib.verbose
  
-@@ -771,7 +771,7 @@ class FontProperties(object):
+@@ -771,7 +771,7 @@
                  return float(self._size)
              except ValueError:
                  pass
@@ -19,7 +19,7 @@ diff -up matplotlib-1.2.0/lib/matplotlib/font_manager.py.orig matplotlib-1.2.0/l
          return default_size * font_scalings.get(self._size)
  
      def get_file(self):
-@@ -991,7 +991,10 @@ class FontManager:
+@@ -991,7 +991,10 @@
          self.afmfiles = findSystemFonts(paths, fontext='afm') + \
              findSystemFonts(fontext='afm')
          self.afmlist = createFontList(self.afmfiles, fontext='afm')
@@ -31,7 +31,7 @@ diff -up matplotlib-1.2.0/lib/matplotlib/font_manager.py.orig matplotlib-1.2.0/l
  
          self.ttf_lookup_cache = {}
          self.afm_lookup_cache = {}
-@@ -1002,7 +1005,8 @@ class FontManager:
+@@ -1002,7 +1005,8 @@
          """
          return self.__default_weight
  
@@ -41,19 +41,19 @@ diff -up matplotlib-1.2.0/lib/matplotlib/font_manager.py.orig matplotlib-1.2.0/l
          """
          Return the default font size.
          """
-@@ -1282,7 +1286,7 @@ if USE_FONTCONFIG and sys.platform != 'w
+@@ -1276,7 +1280,7 @@
+         except OSError:
+             return None
+         if pipe.returncode == 0:
+-            for match in _fc_match_regex.finditer(output):
++            for match in _fc_match_regex.finditer(output.decode("utf-8")):
+                 file = match.group(1)
+                 if os.path.splitext(file)[1][1:] in fontexts:
                      return file
-         return None
- 
--    _fc_match_regex = re.compile(r'\sfile:\s+"([^"]*)"')
-+    _fc_match_regex = re.compile(br'\sfile:\s+"([^"]*)"')
-     _fc_match_cache = {}
- 
-     def findfont(prop, fontext='ttf'):
-diff -up matplotlib-1.2.0/lib/matplotlib/mpl-data/matplotlibrc.orig matplotlib-1.2.0/lib/matplotlib/mpl-data/matplotlibrc
---- matplotlib-1.2.0/lib/matplotlib/mpl-data/matplotlibrc.orig	2013-02-24 22:55:55.684690093 -0300
-+++ matplotlib-1.2.0/lib/matplotlib/mpl-data/matplotlibrc	2013-02-24 22:57:00.146692561 -0300
-@@ -198,7 +198,7 @@ text.hinting_factor : 8 # Specifies the
+diff -ur matplotlib-1.2.0.orig/lib/matplotlib/mpl-data/matplotlibrc matplotlib-1.2.0/lib/matplotlib/mpl-data/matplotlibrc
+--- matplotlib-1.2.0.orig/lib/matplotlib/mpl-data/matplotlibrc	2012-11-08 17:39:20.000000000 +0100
++++ matplotlib-1.2.0/lib/matplotlib/mpl-data/matplotlibrc	2013-04-03 01:50:03.693755542 +0200
+@@ -198,7 +198,7 @@
  #mathtext.it  : serif:italic
  #mathtext.bf  : serif:bold
  #mathtext.sf  : sans
diff --git a/python-matplotlib.spec b/python-matplotlib.spec
index 9dc1e31..b8949aa 100644
--- a/python-matplotlib.spec
+++ b/python-matplotlib.spec
@@ -17,7 +17,7 @@
 
 Name:           python-matplotlib
 Version:        1.2.0
-Release:        11%{?dist}
+Release:        12%{?dist}
 Summary:        Python 2D plotting library
 Group:          Development/Libraries
 License:        Python
@@ -311,6 +311,9 @@ popd
 %endif
 
 %changelog
+* Wed Apr  3 2013 Thomas Spura <tomspur at fedoraproject.org> - 1.2.0-12
+- Decode output of subprocess to utf-8 or regex will fail (#928326)
+
 * Tue Apr  2 2013 pcpa <paulo.cesar.pereira.de.andrade at gmail.com> - 1.2.0-11
 - Make stix-fonts a requires of matplotlib (#928326)
 


More information about the scm-commits mailing list