equal
deleted
inserted
replaced
1 This patch is pulled from upstream; once we pull in 2.1 or newer, it will |
|
2 no longer be necessary. |
|
3 |
|
4 --- Pygments-1.6/pygments/formatters/img.py Sun Feb 3 01:26:49 2013 |
|
5 +++ Pygments-1.6/pygments/formatters/img.py Wed Jan 20 13:33:20 2016 |
|
6 @@ -15,6 +15,8 @@ |
|
7 from pygments.util import get_bool_opt, get_int_opt, \ |
|
8 get_list_opt, get_choice_opt |
|
9 |
|
10 +import subprocess |
|
11 + |
|
12 # Import this carefully |
|
13 try: |
|
14 from PIL import Image, ImageDraw, ImageFont |
|
15 @@ -72,11 +74,11 @@ |
|
16 self._create_nix() |
|
17 |
|
18 def _get_nix_font_path(self, name, style): |
|
19 - from commands import getstatusoutput |
|
20 - exit, out = getstatusoutput('fc-list "%s:style=%s" file' % |
|
21 - (name, style)) |
|
22 - if not exit: |
|
23 - lines = out.splitlines() |
|
24 + proc = subprocess.Popen(['fc-list', "%s:style=%s" % (name, style), 'file'], |
|
25 + stdout=subprocess.PIPE, stderr=None) |
|
26 + stdout, _ = proc.communicate() |
|
27 + if proc.returncode == 0: |
|
28 + lines = stdout.splitlines() |
|
29 if lines: |
|
30 path = lines[0].strip().strip(':') |
|
31 return path |
|