Skip to content

Commit aeba566

Browse files
authored
Vendor in latest requirementslib. (#5659)
* Vendor in lateest requirementslib. * add news fragment
1 parent 740c3c0 commit aeba566

File tree

5 files changed

+25
-82
lines changed

5 files changed

+25
-82
lines changed

news/5659.vendor.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Vendor in latest ``requirementslib==2.2.5`` which includes updates for pip 23.1

pipenv/vendor/requirementslib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .models.pipfile import Pipfile
66
from .models.requirements import Requirement
77

8-
__version__ = "2.2.4"
8+
__version__ = "2.2.5"
99

1010

1111
logger = logging.getLogger(__name__)

pipenv/vendor/requirementslib/models/old_pip_utils.py

Lines changed: 5 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,19 @@
1111
import shutil
1212
import stat
1313

14-
from pipenv.vendor.vistir.path import rmtree
15-
1614
logger = logging.getLogger(__name__)
1715

1816

19-
from typing import Dict, Iterable, List, Optional
20-
21-
from pipenv.patched.pip._internal.models.link import Link
22-
from pipenv.patched.pip._internal.network.download import Downloader
23-
from pipenv.patched.pip._internal.operations.prepare import (
24-
File,
25-
get_file_url,
26-
get_http_url,
27-
unpack_vcs_link,
28-
)
29-
from pipenv.patched.pip._internal.utils.hashes import Hashes
30-
from pipenv.patched.pip._internal.utils.unpacking import unpack_file
17+
from typing import Dict, Iterable, List
3118

3219

33-
def is_socket(path):
34-
# type: (str) -> bool
20+
# This can be removed once this pr is merged
21+
# https://github.com/python/cpython/pull/16575
22+
def is_socket(path: str) -> bool:
3523
return stat.S_ISSOCK(os.lstat(path).st_mode)
3624

3725

38-
def copy2_fixed(src, dest):
39-
# type: (str, str) -> None
26+
def copy2_fixed(src: str, dest: str) -> None:
4027
"""Wrap shutil.copy2() but map errors copying socket files to
4128
SpecialFileError as expected.
4229
@@ -108,55 +95,3 @@ def ignore(d: str, names: List[str]) -> List[str]:
10895
symlinks=True,
10996
copy_function=_copy2_ignoring_special_files,
11097
)
111-
112-
113-
def old_unpack_url(
114-
link: Link,
115-
location: str,
116-
download: Downloader,
117-
verbosity: int,
118-
download_dir: Optional[str] = None,
119-
hashes: Optional[Hashes] = None,
120-
) -> Optional[File]:
121-
"""Unpack link into location, downloading if required.
122-
123-
:param hashes: A Hashes object, one of whose embedded hashes must match,
124-
or HashMismatch will be raised. If the Hashes is empty, no matches are
125-
required, and unhashable types of requirements (like VCS ones, which
126-
would ordinarily raise HashUnsupported) are allowed.
127-
"""
128-
# non-editable vcs urls
129-
if link.is_vcs:
130-
unpack_vcs_link(link, location, verbosity=verbosity)
131-
return None
132-
133-
# Once out-of-tree-builds are no longer supported, could potentially
134-
# replace the below condition with `assert not link.is_existing_dir`
135-
# - unpack_url does not need to be called for in-tree-builds.
136-
#
137-
# As further cleanup, _copy_source_tree and accompanying tests can
138-
# be removed.
139-
#
140-
# TODO when use-deprecated=out-of-tree-build is removed
141-
if link.is_existing_dir():
142-
if os.path.isdir(location):
143-
rmtree(location)
144-
_copy_source_tree(link.file_path, location)
145-
return None
146-
147-
# file urls
148-
if link.is_file:
149-
file = get_file_url(link, download_dir, hashes=hashes)
150-
# http urls
151-
else:
152-
file = get_http_url(
153-
link,
154-
download,
155-
download_dir,
156-
hashes=hashes,
157-
)
158-
# unpack the archive to the build dir location. even when only downloading
159-
# archives, they have to be unpacked to parse dependencies, except wheels
160-
if not link.is_wheel:
161-
unpack_file(file.path, location, file.content_type)
162-
return file

pipenv/vendor/requirementslib/models/setup_info.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from pipenv.patched.pip._vendor.distlib.wheel import Wheel
1919
from pipenv.vendor.pep517 import envbuild, wrappers
2020
from pipenv.patched.pip._internal.network.download import Downloader
21+
from pipenv.patched.pip._internal.operations.prepare import unpack_url
2122
from pipenv.patched.pip._internal.utils.temp_dir import global_tempdir_manager
2223
from pipenv.patched.pip._internal.utils.urls import url_to_path
2324
from pipenv.patched.pip._vendor.packaging.markers import Marker
@@ -36,7 +37,7 @@
3637
from ..environment import MYPY_RUNNING
3738
from ..exceptions import RequirementError
3839
from ..utils import get_pip_command
39-
from .old_pip_utils import old_unpack_url
40+
from .old_pip_utils import _copy_source_tree
4041
from .utils import (
4142
get_default_pyproject_backend,
4243
get_name_variants,
@@ -1514,16 +1515,22 @@ def from_ireq(cls, ireq, subdir=None, finder=None, session=None):
15141515
build_location_func(**build_kwargs)
15151516
ireq.ensure_has_source_dir(kwargs["src_dir"])
15161517
location = None
1517-
if getattr(ireq, "source_dir", None):
1518+
if ireq.source_dir:
15181519
location = ireq.source_dir
1519-
old_unpack_url(
1520-
link=ireq.link,
1521-
location=location,
1522-
download=Downloader(session, "off"),
1523-
verbosity=1,
1524-
download_dir=download_dir,
1525-
hashes=ireq.hashes(True),
1526-
)
1520+
1521+
if ireq.link.is_existing_dir():
1522+
if os.path.isdir(location):
1523+
rmtree(location)
1524+
_copy_source_tree(ireq.link.file_path, location)
1525+
else:
1526+
unpack_url(
1527+
link=ireq.link,
1528+
location=location,
1529+
download=Downloader(session, "off"),
1530+
verbosity=1,
1531+
download_dir=download_dir,
1532+
hashes=ireq.hashes(True),
1533+
)
15271534
created = cls.create(
15281535
ireq.source_dir, subdirectory=subdir, ireq=ireq, kwargs=kwargs, stack=stack
15291536
)

pipenv/vendor/vendor.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ plette[validation]==0.4.4
1212
ptyprocess==0.7.0
1313
python-dotenv==1.0.0
1414
pythonfinder==1.3.2
15-
requirementslib==2.2.4
15+
requirementslib==2.2.5
1616
ruamel.yaml==0.17.21
1717
shellingham==1.5.0.post1
1818
toml==0.10.2

0 commit comments

Comments
 (0)