dev-python/pygments: Removed old.

Package-Manager: Portage-2.3.3, Repoman-2.3.1
This commit is contained in:
Lars Wendler
2017-01-30 18:45:28 +01:00
parent 50458f337c
commit 41385422ef
6 changed files with 0 additions and 213 deletions

View File

@@ -1,16 +0,0 @@
pygments/formatters/img.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pygments/formatters/img.py b/pygments/formatters/img.py
index db5bee3..12d53cd 100644
--- a/pygments/formatters/img.py
+++ b/pygments/formatters/img.py
@@ -84,7 +84,7 @@ class FontManager(object):
if not exit:
lines = out.splitlines()
if lines:
- path = lines[0].strip().strip(':')
+ path = lines[0].decode().strip().strip(':')
return path
def _create_nix(self):

View File

@@ -1,29 +0,0 @@
# HG changeset patch
# User Javantea <jvoss@altsci.com>
# Date 1443460403 25200
# Node ID 6b4baae517b6aaff7142e66f1dbadf7b9b871f61
# Parent 655dbebddc23943b8047b3c139c51c22ef18fd91
Fix Shell Injection in FontManager._get_nix_font_path
diff --git a/pygments/formatters/img.py b/pygments/formatters/img.py
--- a/pygments/formatters/img.py
+++ b/pygments/formatters/img.py
@@ -10,6 +10,7 @@
"""
import sys
+import shlex
from pygments.formatter import Formatter
from pygments.util import get_bool_opt, get_int_opt, get_list_opt, \
@@ -79,8 +80,8 @@
from commands import getstatusoutput
except ImportError:
from subprocess import getstatusoutput
- exit, out = getstatusoutput('fc-list "%s:style=%s" file' %
- (name, style))
+ exit, out = getstatusoutput('fc-list %s file' %
+ shlex.quote("%s:style=%s" % (name, style)))
if not exit:
lines = out.splitlines()
if lines:

View File

@@ -1,56 +0,0 @@
# HG changeset patch
# User Tim Hatch <tim@timhatch.com>
# Date 1445007300 25200
# Node ID 0036ab1c99e256298094505e5e92fdacdfc5b0a8
# Parent c0c0d4049a7c325cd69b764c6ceb7747d319212d
Avoid the shell entirely when finding fonts.
Manually tested on OS X.
diff --git a/pygments/formatters/img.py b/pygments/formatters/img.py
--- a/pygments/formatters/img.py
+++ b/pygments/formatters/img.py
@@ -10,12 +10,13 @@
"""
import sys
-import shlex
from pygments.formatter import Formatter
from pygments.util import get_bool_opt, get_int_opt, get_list_opt, \
get_choice_opt, xrange
+import subprocess
+
# Import this carefully
try:
from PIL import Image, ImageDraw, ImageFont
@@ -76,14 +77,11 @@
self._create_nix()
def _get_nix_font_path(self, name, style):
- try:
- from commands import getstatusoutput
- except ImportError:
- from subprocess import getstatusoutput
- exit, out = getstatusoutput('fc-list %s file' %
- shlex.quote("%s:style=%s" % (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
@@ -198,7 +196,7 @@
bold and italic fonts will be generated. This really should be a
monospace font to look sane.
- Default: "Bitstream Vera Sans Mono"
+ Default: "Bitstream Vera Sans Mono" on Windows, Courier New on *nix
`font_size`
The font size in points to be used.