Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-updates-src > by-pkgid > 04b1995a6c67c6ad1d7aeeef47d44048 > files > 2

python-pygments-1.6-9.1.mga5.src.rpm

Index: Pygments-1.6/pygments/formatters/img.py
===================================================================
--- Pygments-1.6/pygments/formatters/img.py
+++ Pygments-1.6/pygments/formatters/img.py	2015-12-14 21:15:12.520655131 +0100
@@ -15,6 +15,8 @@
 from pygments.util import get_bool_opt, get_int_opt, \
      get_list_opt, get_choice_opt
 
+import subprocess
+
 # Import this carefully
 try:
     from PIL import Image, ImageDraw, ImageFont
@@ -72,11 +74,11 @@
             self._create_nix()
 
     def _get_nix_font_path(self, name, style):
-        from commands import getstatusoutput
-        exit, out = getstatusoutput('fc-list "%s:style=%s" file' %
-                                    (name, style))
-        if not exit:
-            lines = out.splitlines()
+        proc = subprocess.Popen(['fc-list', "%s:style=%s" % (name, style), 'file'],
+                                stdout=subprocess.PIPE, stderr=None)
+        stdout, _ = proc.communicate()
+        if proc.returncode == 0:
+            lines = stdout.splitlines()
             if lines:
                 path = lines[0].strip().strip(':')
                 return path