View | Details | Raw Unified | Return to bug 206072
Collapse All | Expand All

(-)Makefile (+1 lines)
Lines 3-8 Link Here
3
3
4
PORTNAME=	pygments
4
PORTNAME=	pygments
5
PORTVERSION=	2.0.2
5
PORTVERSION=	2.0.2
6
PORTREVISION=	1
6
CATEGORIES=	textproc python
7
CATEGORIES=	textproc python
7
MASTER_SITES=	CHEESESHOP
8
MASTER_SITES=	CHEESESHOP
8
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
9
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
(-)files/patch-CVE-2015-8557 (+49 lines)
Line 0 Link Here
1
# HG changeset patch
2
# User Tim Hatch <tim@timhatch.com>
3
# Date 1445007300 25200
4
# Node ID 0036ab1c99e256298094505e5e92fdacdfc5b0a8
5
# Parent  c0c0d4049a7c325cd69b764c6ceb7747d319212d
6
Avoid the shell entirely when finding fonts.
7
8
Manually tested on OS X.
9
10
--- pygments/formatters/img.py.orig	2014-11-10 19:17:51 UTC
11
+++ pygments/formatters/img.py
12
@@ -15,6 +15,8 @@ from pygments.formatter import Formatter
13
 from pygments.util import get_bool_opt, get_int_opt, get_list_opt, \
14
     get_choice_opt, xrange
15
 
16
+import subprocess
17
+
18
 # Import this carefully
19
 try:
20
     from PIL import Image, ImageDraw, ImageFont
21
@@ -75,14 +77,11 @@ class FontManager(object):
22
             self._create_nix()
23
 
24
     def _get_nix_font_path(self, name, style):
25
-        try:
26
-            from commands import getstatusoutput
27
-        except ImportError:
28
-            from subprocess import getstatusoutput
29
-        exit, out = getstatusoutput('fc-list "%s:style=%s" file' %
30
-                                    (name, style))
31
-        if not exit:
32
-            lines = out.splitlines()
33
+        proc = subprocess.Popen(['fc-list', "%s:style=%s" % (name, style), 'file'],
34
+                                stdout=subprocess.PIPE, stderr=None)
35
+        stdout, _ = proc.communicate()
36
+        if proc.returncode == 0:
37
+            lines = stdout.splitlines()
38
             if lines:
39
                 path = lines[0].strip().strip(':')
40
                 return path
41
@@ -197,7 +196,7 @@ class ImageFormatter(Formatter):
42
         bold and italic fonts will be generated.  This really should be a
43
         monospace font to look sane.
44
 
45
-        Default: "Bitstream Vera Sans Mono"
46
+        Default: "Bitstream Vera Sans Mono" on Windows, Courier New on *nix
47
 
48
     `font_size`
49
         The font size in points to be used.

Return to bug 206072