Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove urllib3 from vendor, use pip._vendor #5215

Merged
merged 3 commits into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ ramdisk:
ramdisk-virtualenv: ramdisk
[ ! -e "/mnt/ramdisk/.venv/bin/activate" ] && \
python -m venv /mnt/ramdisk/.venv
echo "/mnt/ramdisk/.venv" >> $(venv_file)
echo "/mnt/ramdisk/.venv" > $(venv_file)

.PHONY: virtualenv
virtualenv:
[ ! -e $(venv_dir) ] && rm -rvf $(venv_file) && python -m venv $(venv_dir)
@echo $(venv_dir) >> $(venv_file)
@echo $(venv_dir) > $(venv_file)

.PHONY: test-install
test-install:
Expand All @@ -74,7 +74,7 @@ tests: parallel ?= -n auto
tests: suite ?=
tests: submodules test-install
source $(get_venv_path)/bin/activate && \
pipenv run pytest -ra $(parallel) -vvv --full-trace --tb=long
pipenv run pytest -ra $(parallel) -vvv --full-trace --tb=long $(suite)

.PHONY: vendor
vendor: virtualenv
Expand Down
1 change: 1 addition & 0 deletions news/5215.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Remove vendored ``urllib3`` in favor of using it from vendored version in ``pip._vendor``
13 changes: 8 additions & 5 deletions pipenv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@
import warnings

from pipenv.__version__ import __version__ # noqa
from pipenv.patched.pip._vendor.urllib3.exceptions import DependencyWarning

warnings.filterwarnings("ignore", category=DependencyWarning)
warnings.filterwarnings("ignore", category=ResourceWarning)
warnings.filterwarnings("ignore", category=UserWarning)
PIPENV_ROOT = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))

PIPENV_VENDOR = os.sep.join([PIPENV_ROOT, "vendor"])
PIPENV_PATCHED = os.sep.join([PIPENV_ROOT, "patched"])
# PIP_VENDOR = os.sep.join([PIPENV_ROOT, "patched", "pip", "_vendor"])

# sys.path.insert(0, PIP_VENDOR)
# Inject vendored directory into system path.
sys.path.insert(0, PIPENV_VENDOR)
# Inject patched directory into system path.
sys.path.insert(0, PIPENV_PATCHED)

from pipenv.vendor.urllib3.exceptions import DependencyWarning

warnings.filterwarnings("ignore", category=DependencyWarning)
warnings.filterwarnings("ignore", category=ResourceWarning)
warnings.filterwarnings("ignore", category=UserWarning)

# Load patched pip instead of system pip
os.environ["PIP_SHIMS_BASE_MODULE"] = "pipenv.patched.pip"
Expand Down
3 changes: 1 addition & 2 deletions pipenv/utils/indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import re
from collections.abc import Mapping

from urllib3.util import parse_url

from pipenv.exceptions import PipenvUsageError
from pipenv.patched.pip._vendor.urllib3.util import parse_url
from pipenv.utils.constants import MYPY_RUNNING

from .internet import create_mirror_source, is_pypi_url
Expand Down
3 changes: 1 addition & 2 deletions pipenv/utils/internet.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import re
from urllib.parse import urlparse

from urllib3 import util as urllib3_util

from pipenv.patched.pip._vendor.urllib3 import util as urllib3_util
from pipenv.vendor import parse

requests_session = None # type: ignore
Expand Down
4 changes: 2 additions & 2 deletions pipenv/vendor/requirementslib/models/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import pipenv.vendor.attr as attr
from pipenv.vendor.orderedmultidict import omdict
from pipenv.vendor.pip_shims import shims
from pipenv.vendor.urllib3.util import parse_url as urllib3_parse
from pipenv.vendor.urllib3.util.url import Url
from pipenv.patched.pip._vendor.urllib3.util import parse_url as urllib3_parse
from pipenv.patched.pip._vendor.urllib3.util.url import Url

from ..environment import MYPY_RUNNING
from ..utils import is_installable_file
Expand Down
6 changes: 3 additions & 3 deletions pipenv/vendor/requirementslib/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
from pipenv.vendor.plette.models import Package, PackageCollection
from pipenv.vendor.tomlkit.container import Container
from pipenv.vendor.tomlkit.items import AoT, Array, Bool, InlineTable, Item, String, Table
from pipenv.vendor.urllib3 import util as urllib3_util
from pipenv.vendor.urllib3.util import parse_url as urllib3_parse
from pipenv.patched.pip._vendor.urllib3 import util as urllib3_util
from pipenv.patched.pip._vendor.urllib3.util import parse_url as urllib3_parse
from pipenv.vendor.vistir.misc import dedup
from pipenv.vendor.vistir.path import is_valid_url

Expand Down Expand Up @@ -52,7 +52,7 @@
from pipenv.patched.pip._vendor.packaging.requirements import Requirement as PackagingRequirement
from pipenv.vendor.pip_shims.shims import Link
from pkg_resources import Requirement as PkgResourcesRequirement
from pipenv.vendor.urllib3.util.url import Url
from pipenv.patched.pip._vendor.urllib3.util.url import Url

_T = TypeVar("_T")
TMarker = Union[Marker, PkgResourcesMarker]
Expand Down
21 changes: 0 additions & 21 deletions pipenv/vendor/urllib3/LICENSE.txt

This file was deleted.

85 changes: 0 additions & 85 deletions pipenv/vendor/urllib3/__init__.py

This file was deleted.

Loading