From cb1ca34c2899448c7261fb70f2640effd60c7926 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sat, 8 Oct 2022 22:48:51 -0400 Subject: [PATCH] Apply vendoring.update script. --- .../patched/pip/_vendor/pkg_resources/LICENSE | 19 ----------------- pipenv/vendor/plette/__init__.py | 2 +- pipenv/vendor/requirementslib/__init__.py | 2 +- .../requirementslib/models/dependencies.py | 13 ++++-------- .../vendor/requirementslib/models/lockfile.py | 21 +++++++++++++++---- .../vendor/requirementslib/models/pipfile.py | 2 +- .../requirementslib/models/requirements.py | 3 +-- .../requirementslib/models/setup_info.py | 9 ++++---- pipenv/vendor/requirementslib/utils.py | 7 +------ tasks/vendoring/__init__.py | 1 - 10 files changed, 31 insertions(+), 48 deletions(-) delete mode 100644 pipenv/patched/pip/_vendor/pkg_resources/LICENSE diff --git a/pipenv/patched/pip/_vendor/pkg_resources/LICENSE b/pipenv/patched/pip/_vendor/pkg_resources/LICENSE deleted file mode 100644 index 6e0693b4..00000000 --- a/pipenv/patched/pip/_vendor/pkg_resources/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2016 Jason R Coombs - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/pipenv/vendor/plette/__init__.py b/pipenv/vendor/plette/__init__.py index 66cb49db..2823ab86 100644 --- a/pipenv/vendor/plette/__init__.py +++ b/pipenv/vendor/plette/__init__.py @@ -3,7 +3,7 @@ __all__ = [ "Lockfile", "Pipfile", ] -__version__ = '0.3.1' +__version__ = '0.4.0' from .lockfiles import Lockfile from .pipfiles import Pipfile diff --git a/pipenv/vendor/requirementslib/__init__.py b/pipenv/vendor/requirementslib/__init__.py index 7859fd0b..54ac664c 100644 --- a/pipenv/vendor/requirementslib/__init__.py +++ b/pipenv/vendor/requirementslib/__init__.py @@ -5,7 +5,7 @@ from .models.lockfile import Lockfile from .models.pipfile import Pipfile from .models.requirements import Requirement -__version__ = "2.0.3" +__version__ = "2.1.0" logger = logging.getLogger(__name__) diff --git a/pipenv/vendor/requirementslib/models/dependencies.py b/pipenv/vendor/requirementslib/models/dependencies.py index 39613ff6..b78f7fe6 100644 --- a/pipenv/vendor/requirementslib/models/dependencies.py +++ b/pipenv/vendor/requirementslib/models/dependencies.py @@ -22,12 +22,7 @@ from pipenv.vendor.vistir.contextmanagers import temp_environ from pipenv.vendor.vistir.path import create_tracked_tempdir from ..environment import MYPY_RUNNING -from ..utils import ( - _ensure_dir, - get_package_finder, - get_pip_command, - prepare_pip_source_args, -) +from ..utils import get_package_finder, get_pip_command, prepare_pip_source_args from .cache import CACHE_DIR, DependencyCache from .setup_info import SetupInfo from .utils import ( @@ -564,7 +559,7 @@ def get_pip_options(args=None, sources=None, pip_command=None): pip_command = get_pip_command() if not sources: sources = [{"url": "https://pypi.org/simple", "name": "pypi", "verify_ssl": True}] - _ensure_dir(CACHE_DIR) + os.makedirs(CACHE_DIR, mode=0o777, exist_ok=True) pip_args = args or [] pip_args = prepare_pip_source_args(sources, pip_args) pip_options, _ = pip_command.parser.parse_args(pip_args) @@ -620,7 +615,7 @@ def start_resolver(finder=None, session=None, wheel_cache=None): session = pip_command._build_session(pip_options) download_dir = PKGS_DOWNLOAD_DIR - _ensure_dir(download_dir) + os.makedir(download_dir, mode=0o777) _build_dir = create_tracked_tempdir(fs_str("build")) _source_dir = create_tracked_tempdir(fs_str("source")) @@ -629,7 +624,7 @@ def start_resolver(finder=None, session=None, wheel_cache=None): with global_tempdir_manager(), get_build_tracker() as build_tracker: if not wheel_cache: wheel_cache = _get_wheel_cache() - _ensure_dir(str(os.path.join(wheel_cache.cache_dir, "wheels"))) + os.makdirs(os.path.join(wheel_cache.cache_dir, "wheels")) preparer = pip_command.make_requirement_preparer( temp_build_dir=_build_dir, options=pip_options, diff --git a/pipenv/vendor/requirementslib/models/lockfile.py b/pipenv/vendor/requirementslib/models/lockfile.py index e2ed4d0f..7d64a638 100644 --- a/pipenv/vendor/requirementslib/models/lockfile.py +++ b/pipenv/vendor/requirementslib/models/lockfile.py @@ -262,8 +262,8 @@ class Lockfile(object): section. :param bool dev: Indicates whether to use dev requirements, defaults to False - :return: Requirements from the relevant the relevant pipfile - :rtype: :class:`~requirementslib.models.requirements.Requirement` + :return: Requirements from the relevant pipfile + :rtype: :class:`Iterator[~requirementslib.models.requirements.Requirement]` """ if categories: deps = {} @@ -285,10 +285,23 @@ class Lockfile(object): def requirements_list(self, category): if self._lockfile.get(category): - return [{name: entry._data} for name, entry in self._lockfile[category].items()] + return [ + {name: entry._data} for name, entry in self._lockfile[category].items() + ] return [] + def as_requirements(self, category, include_hashes=False): + """Returns a list of requirements in pip-style format.""" + lines = [] + section = list(self.get_requirements(categories=[category])) + for req in section: + kwargs = {"include_hashes": include_hashes} + if req.editable: + kwargs["include_markers"] = False + r = req.as_line(**kwargs) + lines.append(r.strip()) + return lines + def write(self): self.projectfile.model = copy.deepcopy(self._lockfile) self.projectfile.write() - diff --git a/pipenv/vendor/requirementslib/models/pipfile.py b/pipenv/vendor/requirementslib/models/pipfile.py index fecce991..783d249c 100644 --- a/pipenv/vendor/requirementslib/models/pipfile.py +++ b/pipenv/vendor/requirementslib/models/pipfile.py @@ -4,8 +4,8 @@ import os from pathlib import Path import pipenv.vendor.attr as attr -from pipenv.vendor.plette import pipfiles import pipenv.vendor.tomlkit as tomlkit +from pipenv.vendor.plette import pipfiles from ..environment import MYPY_RUNNING from ..exceptions import RequirementError diff --git a/pipenv/vendor/requirementslib/models/requirements.py b/pipenv/vendor/requirementslib/models/requirements.py index 30f461e0..609f8d8b 100644 --- a/pipenv/vendor/requirementslib/models/requirements.py +++ b/pipenv/vendor/requirementslib/models/requirements.py @@ -38,7 +38,6 @@ from pipenv.vendor.vistir.path import ( get_converted_relative_path, is_file_url, is_valid_url, - mkdir_p, normalize_path, ) @@ -2123,7 +2122,7 @@ class VCSRequirement(FileRequirement): return checkout_dir if src_dir is not None: checkout_dir = os.path.join(os.path.abspath(src_dir), self.name) - mkdir_p(src_dir) + os.makedirs(src_dir, exist_ok=True) return checkout_dir return os.path.join(create_tracked_tempdir(prefix="requirementslib"), self.name) diff --git a/pipenv/vendor/requirementslib/models/setup_info.py b/pipenv/vendor/requirementslib/models/setup_info.py index d544cbfb..6a11683d 100644 --- a/pipenv/vendor/requirementslib/models/setup_info.py +++ b/pipenv/vendor/requirementslib/models/setup_info.py @@ -31,7 +31,7 @@ from pipenv.patched.pip._vendor.pkg_resources import ( from pipenv.vendor.platformdirs import user_cache_dir from pipenv.vendor.vistir.contextmanagers import cd, temp_path from pipenv.vendor.vistir.misc import run -from pipenv.vendor.vistir.path import create_tracked_tempdir, ensure_mkdir_p, mkdir_p, rmtree +from pipenv.vendor.vistir.path import create_tracked_tempdir, rmtree from ..environment import MYPY_RUNNING from ..exceptions import RequirementError @@ -559,7 +559,6 @@ def build_pep517(source_dir, build_dir, config_settings=None, dist_type="wheel") return build_fn(build_dir, config_settings) -@ensure_mkdir_p(mode=0o775) def _get_src_dir(root): # type: (AnyStr) -> AnyStr src = os.environ.get("PIP_SRC") @@ -573,6 +572,8 @@ def _get_src_dir(root): src_dir = create_tracked_tempdir(prefix="requirementslib-", suffix="-src") else: src_dir = os.path.join(root, "src") + + os.makedirs(src_dir, mode=0o775) return src_dir @@ -613,10 +614,10 @@ def _prepare_wheel_building_kwargs( ): # type: (...) -> Dict[STRING_TYPE, STRING_TYPE] download_dir = os.path.join(CACHE_DIR, "pkgs") # type: STRING_TYPE - mkdir_p(download_dir) + os.makedirs(download_dir, exist_ok=True) wheel_download_dir = os.path.join(CACHE_DIR, "wheels") # type: STRING_TYPE - mkdir_p(wheel_download_dir) + os.makedirs(wheel_download_dir, exist_ok=True) if src_dir is None: if editable and src_root is not None: src_dir = src_root diff --git a/pipenv/vendor/requirementslib/utils.py b/pipenv/vendor/requirementslib/utils.py index be650e0e..a7fb37cc 100644 --- a/pipenv/vendor/requirementslib/utils.py +++ b/pipenv/vendor/requirementslib/utils.py @@ -12,7 +12,7 @@ from pipenv.patched.pip._internal.models.target_python import TargetPython from pipenv.patched.pip._internal.utils.filetypes import is_archive_file from pipenv.patched.pip._internal.utils.misc import is_installable_dir from pipenv.patched.pip._vendor.packaging import specifiers -from pipenv.vendor.vistir.path import ensure_mkdir_p, is_valid_url +from pipenv.vendor.vistir.path import is_valid_url from .environment import MYPY_RUNNING @@ -292,11 +292,6 @@ def get_package_finder( ) -@ensure_mkdir_p(mode=0o777) -def _ensure_dir(path): - return path - - _UNSET = object() _REMAP_EXIT = object() diff --git a/tasks/vendoring/__init__.py b/tasks/vendoring/__init__.py index 41aaacef..c7703f49 100644 --- a/tasks/vendoring/__init__.py +++ b/tasks/vendoring/__init__.py @@ -63,7 +63,6 @@ LIBRARY_RENAMES = { "packaging": "pipenv.patched.pip._vendor.packaging", "pep517": "pipenv.patched.pip._vendor.pep517", "pkg_resources": "pipenv.patched.pip._vendor.pkg_resources", - "plette": "pipenv.vendor.plette", "urllib3": "pipenv.patched.pip._vendor.urllib3", "zipp": "pipenv.vendor.zipp", }