Skip to content

Commit

Permalink
Bump to vendoring 1.0.x
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pradyunsg committed Sep 11, 2021
1 parent 48dc9f4 commit 266d339
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 18 deletions.
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def lint(session: nox.Session) -> None:

@nox.session
def vendoring(session: nox.Session) -> None:
session.install("vendoring>=0.3.0")
session.install("vendoring~=1.0.0")

if "--upgrade" not in session.posargs:
session.run("vendoring", "sync", ".", "-v")
Expand Down
1 change: 0 additions & 1 deletion src/pip/_vendor/idna.pyi

This file was deleted.

1 change: 0 additions & 1 deletion src/pip/_vendor/packaging.pyi

This file was deleted.

1 change: 0 additions & 1 deletion src/pip/_vendor/resolvelib.pyi

This file was deleted.

1 change: 0 additions & 1 deletion src/pip/_vendor/tenacity.pyi

This file was deleted.

1 change: 0 additions & 1 deletion src/pip/_vendor/tomli.pyi

This file was deleted.

4 changes: 2 additions & 2 deletions src/pip/_vendor/urllib3/contrib/pyopenssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
.. code-block:: python
try:
import urllib3.contrib.pyopenssl
urllib3.contrib.pyopenssl.inject_into_urllib3()
import pip._vendor.urllib3.contrib.pyopenssl as pyopenssl
pyopenssl.inject_into_urllib3()
except ImportError:
pass
Expand Down
4 changes: 2 additions & 2 deletions src/pip/_vendor/urllib3/contrib/securetransport.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
To use this module, simply import and inject it::
import urllib3.contrib.securetransport
urllib3.contrib.securetransport.inject_into_urllib3()
import pip._vendor.urllib3.contrib.securetransport as securetransport
securetransport.inject_into_urllib3()
Happy TLSing!
Expand Down
14 changes: 7 additions & 7 deletions tools/vendoring/patches/requests.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ index 0f8ae0d38..9582fa730 100644
import sys

-try:
- from pip._vendor import chardet
- import chardet
-except ImportError:
- import charset_normalizer as chardet
- import warnings
Expand Down Expand Up @@ -40,7 +40,7 @@ diff --git a/src/pip/_vendor/requests/__init__.py b/src/pip/_vendor/requests/__i
index 973497f5e..4f80e28fc 100644
--- a/src/pip/_vendor/requests/__init__.py
+++ b/src/pip/_vendor/requests/__init__.py
@@ -44,10 +44,7 @@ from pip._vendor import urllib3
@@ -44,10 +44,7 @@ import urllib3
import warnings
from .exceptions import RequestsDependencyWarning

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

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

-try:
- from pip._vendor import chardet
- import chardet
-except ImportError:
- import charset_normalizer as chardet
+from pip._vendor import chardet
+import chardet

import sys

Expand Down Expand Up @@ -105,7 +105,7 @@ diff --git a/src/pip/_vendor/requests/help.py b/src/pip/_vendor/requests/help.py
index 3a843404c..745f0d7b3 100644
--- a/src/pip/_vendor/requests/help.py
+++ b/src/pip/_vendor/requests/help.py
@@ -11,10 +11,7 @@ from pip._vendor import urllib3
@@ -11,10 +11,7 @@ import urllib3

from . import __version__ as requests_version

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

try:
from pip._vendor import chardet
import chardet
29 changes: 29 additions & 0 deletions tools/vendoring/patches/urllib3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/src/pip/_vendor/urllib3/contrib/securetransport.py b/src/pip/_vendor/urllib3/contrib/securetransport.py
index b97555454..189132baa 100644
--- a/src/pip/_vendor/urllib3/contrib/securetransport.py
+++ b/src/pip/_vendor/urllib3/contrib/securetransport.py
@@ -19,8 +19,8 @@

To use this module, simply import and inject it::

- import urllib3.contrib.securetransport
- urllib3.contrib.securetransport.inject_into_urllib3()
+ import urllib3.contrib.securetransport as securetransport
+ securetransport.inject_into_urllib3()

Happy TLSing!

diff --git a/src/pip/_vendor/urllib3/contrib/pyopenssl.py b/src/pip/_vendor/urllib3/contrib/pyopenssl.py
index c43146279..4cded53f6 100644
--- a/src/pip/_vendor/urllib3/contrib/pyopenssl.py
+++ b/src/pip/_vendor/urllib3/contrib/pyopenssl.py
@@ -28,7 +28,7 @@
.. code-block:: python

try:
- import urllib3.contrib.pyopenssl
- urllib3.contrib.pyopenssl.inject_into_urllib3()
+ import urllib3.contrib.pyopenssl as pyopenssl
+ pyopenssl.inject_into_urllib3()
except ImportError:
pass
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ basepython = python3
skip_install = True
commands_pre =
deps =
vendoring~=0.3.3
vendoring~=1.0.0
# Required, otherwise we interpret --no-binary :all: as
# "do not build wheels", which fails for PEP 517 requirements
pip>=19.3.1
Expand Down

0 comments on commit 266d339

Please sign in to comment.