summaryrefslogtreecommitdiff
path: root/tools/vendoring/patches/pygments.patch
blob: 035c7dcaea671a2774a902dafd592a0dcc00fabc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
This patch mainly handles tweaking imports into a form that can be transformed
to import from the vendored namespace.

diff --git a/src/pip/_vendor/pygments/cmdline.py b/src/pip/_vendor/pygments/cmdline.py
index d9a0fdc8b..db6de0cd3 100644
--- a/src/pip/_vendor/pygments/cmdline.py
+++ b/src/pip/_vendor/pygments/cmdline.py
@@ -410,11 +410,11 @@ def is_only_option(opt):
         outfile = UnclosingTextIOWrapper(outfile, encoding=fmter.encoding)
         fmter.encoding = None
         try:
-            import colorama.initialise
+            import colorama.initialise as colorama_initialise
         except ImportError:
             pass
         else:
-            outfile = colorama.initialise.wrap_stream(
+            outfile = colorama_initialise.wrap_stream(
                 outfile, convert=None, strip=None, autoreset=False, wrap=True)

     # When using the LaTeX formatter and the option `escapeinside` is
diff --git a/src/pip/_vendor/pygments/__main__.py b/src/pip/_vendor/pygments/__main__.py
index c6e2517df..76255b525 100644
--- a/src/pip/_vendor/pygments/__main__.py
+++ b/src/pip/_vendor/pygments/__main__.py
@@ -9,9 +9,9 @@
 """

 import sys
-import pygments.cmdline
+from pygments.cmdline import main

 try:
-    sys.exit(pygments.cmdline.main(sys.argv))
+    sys.exit(main(sys.argv))
 except KeyboardInterrupt:
     sys.exit(1)
diff --git a/src/pip/_vendor/pygments/sphinxext.py b/src/pip/_vendor/pygments/sphinxext.py
index 3ea2e36e1..23c19504c 100644
--- a/src/pip/_vendor/pygments/sphinxext.py
+++ b/src/pip/_vendor/pygments/sphinxext.py
@@ -91,7 +91,7 @@ class PygmentsDoc(Directive):
         The columns are the lexer name, the extensions handled by this lexer
         (or "None"), the aliases and a link to the lexer class."""
         from pygments.lexers._mapping import LEXERS
-        import pygments.lexers
+        from pygments.lexers import find_lexer_class
         out = []
 
         table = []
@@ -102,7 +102,7 @@ class PygmentsDoc(Directive):
             return name
 
         for classname, data in sorted(LEXERS.items(), key=lambda x: x[1][1].lower()):
-            lexer_cls = pygments.lexers.find_lexer_class(data[1])
+            lexer_cls = find_lexer_class(data[1])
             extensions = lexer_cls.filenames + lexer_cls.alias_filenames
 
             table.append({