Skip to content

Commit 3b8113d

Browse files
committed
Bump to vendoring 1.0.x
This now supports: - Clearer failure mode, for imports of the format `import x.y` - Regular expression support for dropping files (useful for when we vendor pygments) - Patching files prior to rewriting imports, allowing generation of patches on the original package sources. - Detection of py.typed files, which omits generation of unnecessary `.pyi` stubs.
1 parent 48dc9f4 commit 3b8113d

File tree

11 files changed

+42
-18
lines changed

11 files changed

+42
-18
lines changed

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def lint(session: nox.Session) -> None:
171171

172172
@nox.session
173173
def vendoring(session: nox.Session) -> None:
174-
session.install("vendoring>=0.3.0")
174+
session.install("vendoring~=1.0.0")
175175

176176
if "--upgrade" not in session.posargs:
177177
session.run("vendoring", "sync", ".", "-v")

src/pip/_vendor/idna.pyi

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/pip/_vendor/packaging.pyi

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/pip/_vendor/resolvelib.pyi

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/pip/_vendor/tenacity.pyi

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/pip/_vendor/tomli.pyi

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/pip/_vendor/urllib3/contrib/pyopenssl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
.. code-block:: python
2929
3030
try:
31-
import urllib3.contrib.pyopenssl
32-
urllib3.contrib.pyopenssl.inject_into_urllib3()
31+
import pip._vendor.urllib3.contrib.pyopenssl as pyopenssl
32+
pyopenssl.inject_into_urllib3()
3333
except ImportError:
3434
pass
3535

src/pip/_vendor/urllib3/contrib/securetransport.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
2020
To use this module, simply import and inject it::
2121
22-
import urllib3.contrib.securetransport
23-
urllib3.contrib.securetransport.inject_into_urllib3()
22+
import pip._vendor.urllib3.contrib.securetransport as securetransport
23+
securetransport.inject_into_urllib3()
2424
2525
Happy TLSing!
2626

tools/vendoring/patches/requests.patch

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ index 0f8ae0d38..9582fa730 100644
66
import sys
77

88
-try:
9-
- from pip._vendor import chardet
9+
- import chardet
1010
-except ImportError:
1111
- import charset_normalizer as chardet
1212
- import warnings
@@ -40,7 +40,7 @@ diff --git a/src/pip/_vendor/requests/__init__.py b/src/pip/_vendor/requests/__i
4040
index 973497f5e..4f80e28fc 100644
4141
--- a/src/pip/_vendor/requests/__init__.py
4242
+++ b/src/pip/_vendor/requests/__init__.py
43-
@@ -44,10 +44,7 @@ from pip._vendor import urllib3
43+
@@ -44,10 +44,7 @@ import urllib3
4444
import warnings
4545
from .exceptions import RequestsDependencyWarning
4646

@@ -51,7 +51,7 @@ index 973497f5e..4f80e28fc 100644
5151
+charset_normalizer_version = None
5252

5353
try:
54-
from pip._vendor.chardet import __version__ as chardet_version
54+
from chardet import __version__ as chardet_version
5555
@@ -107,6 +104,11 @@ except (AssertionError, ValueError):
5656
# if the standard library doesn't support SNI or the
5757
# 'ssl' library isn't available.
@@ -74,10 +74,10 @@ index 409b7b028..9e2937167 100644
7474
"""
7575

7676
-try:
77-
- from pip._vendor import chardet
77+
- import chardet
7878
-except ImportError:
7979
- import charset_normalizer as chardet
80-
+from pip._vendor import chardet
80+
+import chardet
8181

8282
import sys
8383

@@ -105,7 +105,7 @@ diff --git a/src/pip/_vendor/requests/help.py b/src/pip/_vendor/requests/help.py
105105
index 3a843404c..745f0d7b3 100644
106106
--- a/src/pip/_vendor/requests/help.py
107107
+++ b/src/pip/_vendor/requests/help.py
108-
@@ -11,10 +11,7 @@ from pip._vendor import urllib3
108+
@@ -11,10 +11,7 @@ import urllib3
109109

110110
from . import __version__ as requests_version
111111

@@ -116,4 +116,4 @@ index 3a843404c..745f0d7b3 100644
116116
+charset_normalizer = None
117117

118118
try:
119-
from pip._vendor import chardet
119+
import chardet

tools/vendoring/patches/urllib3.patch

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
diff --git a/src/pip/_vendor/urllib3/contrib/securetransport.py b/src/pip/_vendor/urllib3/contrib/securetransport.py
2+
index b97555454..189132baa 100644
3+
--- a/src/pip/_vendor/urllib3/contrib/securetransport.py
4+
+++ b/src/pip/_vendor/urllib3/contrib/securetransport.py
5+
@@ -19,8 +19,8 @@
6+
7+
To use this module, simply import and inject it::
8+
9+
- import urllib3.contrib.securetransport
10+
- urllib3.contrib.securetransport.inject_into_urllib3()
11+
+ import urllib3.contrib.securetransport as securetransport
12+
+ securetransport.inject_into_urllib3()
13+
14+
Happy TLSing!
15+
16+
diff --git a/src/pip/_vendor/urllib3/contrib/pyopenssl.py b/src/pip/_vendor/urllib3/contrib/pyopenssl.py
17+
index c43146279..4cded53f6 100644
18+
--- a/src/pip/_vendor/urllib3/contrib/pyopenssl.py
19+
+++ b/src/pip/_vendor/urllib3/contrib/pyopenssl.py
20+
@@ -28,7 +28,7 @@
21+
.. code-block:: python
22+
23+
try:
24+
- import urllib3.contrib.pyopenssl
25+
- urllib3.contrib.pyopenssl.inject_into_urllib3()
26+
+ import urllib3.contrib.pyopenssl as pyopenssl
27+
+ pyopenssl.inject_into_urllib3()
28+
except ImportError:
29+
pass

0 commit comments

Comments
 (0)