diff --git a/news/4302.vendor.rst b/news/4302.vendor.rst new file mode 100644 index 0000000000..daf2ca20f1 --- /dev/null +++ b/news/4302.vendor.rst @@ -0,0 +1,4 @@ +- Updated vendored dependencies: + + - **pythonfinder**: ``1.2.2`` => ``1.2.4`` + - **requirementslib**: ``1.5.9`` => ``1.5.10`` diff --git a/pipenv/vendor/pythonfinder/LICENSE b/pipenv/vendor/pythonfinder/LICENSE deleted file mode 100644 index c7ac395fb9..0000000000 --- a/pipenv/vendor/pythonfinder/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016 Steve Dower - -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/pythonfinder/__init__.py b/pipenv/vendor/pythonfinder/__init__.py index 6ba8a67de9..249cfd9103 100644 --- a/pipenv/vendor/pythonfinder/__init__.py +++ b/pipenv/vendor/pythonfinder/__init__.py @@ -10,7 +10,7 @@ from .models import SystemPath, WindowsFinder from .pythonfinder import Finder -__version__ = "1.2.2" +__version__ = "1.2.4" logger = logging.getLogger(__name__) diff --git a/pipenv/vendor/pythonfinder/models/path.py b/pipenv/vendor/pythonfinder/models/path.py index a8070c912f..5c672715c3 100644 --- a/pipenv/vendor/pythonfinder/models/path.py +++ b/pipenv/vendor/pythonfinder/models/path.py @@ -27,7 +27,6 @@ Sequence, dedup, ensure_path, - expand_paths, filter_pythons, is_in_path, normalize_path, diff --git a/pipenv/vendor/pythonfinder/models/python.py b/pipenv/vendor/pythonfinder/models/python.py index ff249be2b0..4f7e556350 100644 --- a/pipenv/vendor/pythonfinder/models/python.py +++ b/pipenv/vendor/pythonfinder/models/python.py @@ -18,6 +18,7 @@ RE_MATCHER, _filter_none, ensure_path, + expand_paths, get_python_version, guess_company, is_in_path, @@ -286,12 +287,10 @@ def find_all_python_versions( ] else: pythons = [sub_finder(path) for path in self.paths] - pythons = [p for p in pythons if p and p.is_python and p.as_python is not None] + pythons = expand_paths(pythons, True) version_sort = operator.attrgetter("as_python.version_sort") paths = [ - p - for p in sorted(list(pythons), key=version_sort, reverse=True) - if p is not None + p for p in sorted(pythons, key=version_sort, reverse=True) if p is not None ] return paths diff --git a/pipenv/vendor/pythonfinder/models/windows.py b/pipenv/vendor/pythonfinder/models/windows.py index 39353cdb4e..928f0ff23a 100644 --- a/pipenv/vendor/pythonfinder/models/windows.py +++ b/pipenv/vendor/pythonfinder/models/windows.py @@ -42,7 +42,10 @@ def find_all_python_versions( ) pythons = [py for py in self.version_list if version_matcher(py)] version_sort = operator.attrgetter("version_sort") - return [c.comes_from for c in sorted(pythons, key=version_sort, reverse=True)] + return [ + c.comes_from for c in sorted(pythons, key=version_sort, reverse=True) + if c.comes_from + ] def find_python_version( self, diff --git a/pipenv/vendor/pythonfinder/utils.py b/pipenv/vendor/pythonfinder/utils.py index ef48e6281b..bcea7f3ed8 100644 --- a/pipenv/vendor/pythonfinder/utils.py +++ b/pipenv/vendor/pythonfinder/utils.py @@ -422,7 +422,7 @@ def expand_paths(path, only_python=True): isinstance(path, Sequence) and not getattr(path.__class__, "__name__", "") == "PathEntry" ): - for p in unnest(path): + for p in path: if p is None: continue for expanded in itertools.chain.from_iterable( @@ -437,7 +437,9 @@ def expand_paths(path, only_python=True): ): yield sub_path else: - if path is not None and path.is_python and path.as_python is not None: + if path is not None and ( + not only_python or (path.is_python and path.as_python is not None) + ): yield path diff --git a/pipenv/vendor/requirementslib/__init__.py b/pipenv/vendor/requirementslib/__init__.py index 8fc573d1a6..90fccc6c8e 100644 --- a/pipenv/vendor/requirementslib/__init__.py +++ b/pipenv/vendor/requirementslib/__init__.py @@ -10,7 +10,7 @@ from .models.pipfile import Pipfile from .models.requirements import Requirement -__version__ = "1.5.9" +__version__ = "1.5.10" logger = logging.getLogger(__name__) diff --git a/pipenv/vendor/requirementslib/models/requirements.py b/pipenv/vendor/requirementslib/models/requirements.py index 3ce8d8f510..77ba0fd879 100644 --- a/pipenv/vendor/requirementslib/models/requirements.py +++ b/pipenv/vendor/requirementslib/models/requirements.py @@ -1013,7 +1013,7 @@ def _parse_name_from_path(self): parsed_setup_py = self.parsed_setup_py if parsed_setup_py: name = parsed_setup_py.get("name", "") - if name: + if name and isinstance(name, six.string_types): return name return None diff --git a/pipenv/vendor/requirementslib/models/setup_info.py b/pipenv/vendor/requirementslib/models/setup_info.py index 9c97a3944e..9d3829c471 100644 --- a/pipenv/vendor/requirementslib/models/setup_info.py +++ b/pipenv/vendor/requirementslib/models/setup_info.py @@ -469,21 +469,18 @@ def iter_metadata(path, pkg_name=None, metadata_type="egg-info"): # type: (AnyStr, Optional[AnyStr], AnyStr) -> Generator if pkg_name is not None: pkg_variants = get_name_variants(pkg_name) - non_matching_dirs = [] - with contextlib.closing(ScandirCloser(path)) as path_iterator: - for entry in path_iterator: - if entry.is_dir(): - entry_name, ext = os.path.splitext(entry.name) - if ext.endswith(metadata_type): - if pkg_name is None or entry_name.lower() in pkg_variants: - yield entry - elif not entry.name.endswith(metadata_type): - non_matching_dirs.append(entry) - for entry in non_matching_dirs: - for dir_entry in iter_metadata( - entry.path, pkg_name=pkg_name, metadata_type=metadata_type - ): - yield dir_entry + dirs_to_search = [path] + while dirs_to_search: + p = dirs_to_search.pop(0) + with contextlib.closing(ScandirCloser(p)) as path_iterator: + for entry in path_iterator: + if entry.is_dir(): + entry_name, ext = os.path.splitext(entry.name) + if ext.endswith(metadata_type): + if pkg_name is None or entry_name.lower() in pkg_variants: + yield entry + elif not entry.name.endswith(metadata_type): + dirs_to_search.append(entry.path) def find_egginfo(target, pkg_name=None): @@ -729,14 +726,16 @@ def unmap_binops(self): self.binOps_map[binop] = ast_unparse(binop, analyzer=self) def match_assignment_str(self, match): - return next( - iter(k for k in self.assignments if getattr(k, "id", "") == match), None - ) + matches = [k for k in self.assignments if getattr(k, "id", "") == match] + if matches: + return matches[-1] + return None def match_assignment_name(self, match): - return next( - iter(k for k in self.assignments if getattr(k, "id", "") == match.id), None - ) + matches = [k for k in self.assignments if getattr(k, "id", "") == match.id] + if matches: + return matches[-1] + return None def generic_unparse(self, item): if any(isinstance(item, k) for k in AST_BINOP_MAP.keys()): @@ -771,7 +770,7 @@ def unparse_Subscript(self, item): if isinstance(item.slice, ast.Index): try: unparsed = unparsed[self.unparse(item.slice.value)] - except KeyError: + except (KeyError, TypeError): # not everything can be looked up before runtime unparsed = item return unparsed @@ -838,7 +837,7 @@ def unparse_Compare(self, item): if isinstance(item.left, ast.Attribute) or isinstance(item.left, ast.Str): import importlib - left = unparse(item.left) + left = self.unparse(item.left) if "." in left: name, _, val = left.rpartition(".") left = getattr(importlib.import_module(name), val, left) @@ -1002,7 +1001,7 @@ def ast_unparse(item, initial_mapping=False, analyzer=None, recurse=True): # no if isinstance(item.slice, ast.Index): try: unparsed = unparsed[unparse(item.slice.value)] - except KeyError: + except (KeyError, TypeError): # not everything can be looked up before runtime unparsed = item elif any(isinstance(item, k) for k in AST_BINOP_MAP.keys()): @@ -1848,7 +1847,7 @@ def from_ireq(cls, ireq, subdir=None, finder=None, session=None): is_vcs = True if vcs else is_artifact_or_vcs if is_file and not is_vcs and path is not None and os.path.isdir(path): target = os.path.join(kwargs["src_dir"], os.path.basename(path)) - shutil.copytree(path, target) + shutil.copytree(path, target, symlinks=True) ireq.source_dir = target if not (ireq.editable and is_file and is_vcs): if ireq.is_wheel: diff --git a/pipenv/vendor/requirementslib/models/url.py b/pipenv/vendor/requirementslib/models/url.py index b0c98de8e5..befacdb612 100644 --- a/pipenv/vendor/requirementslib/models/url.py +++ b/pipenv/vendor/requirementslib/models/url.py @@ -4,7 +4,7 @@ from pipenv.vendor import attr import pip_shims.shims from orderedmultidict import omdict -from six.moves.urllib.parse import quote_plus, unquote_plus +from six.moves.urllib.parse import quote, unquote_plus, unquote as url_unquote from urllib3 import util as urllib3_util from urllib3.util import parse_url as urllib3_parse from urllib3.util.url import Url @@ -42,8 +42,8 @@ def _get_parsed_url(url): auth, _, url = url.rpartition("@") url = "{scheme}://{url}".format(scheme=scheme, url=url) parsed = urllib3_parse(url)._replace(auth=auth) - if parsed.auth and unquote_plus(parsed.auth) != parsed.auth: - return parsed._replace(auth=unquote_plus(parsed.auth)) + if parsed.auth: + return parsed._replace(auth=url_unquote(parsed.auth)) return parsed @@ -110,7 +110,7 @@ def _parse_query(self): subdirectory = self.subdirectory if self.subdirectory else None for q in queries: key, _, val = q.partition("=") - val = unquote_plus(val.replace("+", " ")) + val = unquote_plus(val) if key == "subdirectory" and not subdirectory: subdirectory = val else: @@ -132,7 +132,7 @@ def _parse_fragment(self): extras = self.extras for q in fragments: key, _, val = q.partition("=") - val = unquote_plus(val.replace("+", " ")) + val = unquote_plus(val) fragment_items[key] = val if key == "egg": from .utils import parse_extras @@ -158,10 +158,10 @@ def _parse_auth(self): username_is_quoted, password_is_quoted = False, False quoted_username, quoted_password = "", "" if password: - quoted_password = quote_plus(password) + quoted_password = quote(password) password_is_quoted = quoted_password != password if username: - quoted_username = quote_plus(username) + quoted_username = quote(username) username_is_quoted = quoted_username != username return attr.evolve( self, @@ -176,14 +176,14 @@ def get_password(self, unquote=False, include_token=True): # type: (bool, bool) -> str password = self.password if self.password else "" if password and unquote and self._password_is_quoted: - password = unquote_plus(password) + password = url_unquote(password) return password def get_username(self, unquote=False): # type: (bool) -> str username = self.username if self.username else "" if username and unquote and self._username_is_quoted: - username = unquote_plus(username) + username = url_unquote(username) return username @staticmethod diff --git a/pipenv/vendor/toml/LICENSE.txt b/pipenv/vendor/toml/LICENSE similarity index 100% rename from pipenv/vendor/toml/LICENSE.txt rename to pipenv/vendor/toml/LICENSE diff --git a/pipenv/vendor/vendor.txt b/pipenv/vendor/vendor.txt index 3e08152026..19da8533c7 100644 --- a/pipenv/vendor/vendor.txt +++ b/pipenv/vendor/vendor.txt @@ -20,18 +20,18 @@ pipdeptree==0.13.2 pipreqs==0.4.10 docopt==0.6.2 yarg==0.1.9 -pythonfinder==1.2.2 +pythonfinder==1.2.4 requests==2.23.0 chardet==3.0.4 idna==2.9 urllib3==1.25.9 certifi==2020.4.5.1 -requirementslib==1.5.9 +requirementslib==1.5.10 attrs==19.3.0 distlib==0.3.0 packaging==20.3 pyparsing==2.4.7 - git+https://github.com/sarugaku/plette.git@master#egg=plette + plette==0.2.3 tomlkit==0.5.11 shellingham==1.3.2 six==1.14.0 diff --git a/tasks/vendoring/patches/vendor/pythonfinder-import.patch b/tasks/vendoring/patches/vendor/pythonfinder-import.patch new file mode 100644 index 0000000000..6b9756ad9b --- /dev/null +++ b/tasks/vendoring/patches/vendor/pythonfinder-import.patch @@ -0,0 +1,78 @@ +diff --git a/pipenv/vendor/pythonfinder/compat.py b/pipenv/vendor/pythonfinder/compat.py +index 6fb4542f..d76c4efc 100644 +--- a/pipenv/vendor/pythonfinder/compat.py ++++ b/pipenv/vendor/pythonfinder/compat.py +@@ -4,7 +4,7 @@ import sys + import six + + if sys.version_info[:2] <= (3, 4): +- from pathlib2 import Path # type: ignore # noqa ++ from pipenv.vendor.pathlib2 import Path # type: ignore # noqa + else: + from pathlib import Path + +diff --git a/pipenv/vendor/pythonfinder/models/mixins.py b/pipenv/vendor/pythonfinder/models/mixins.py +index 76327115..aeba0443 100644 +--- a/pipenv/vendor/pythonfinder/models/mixins.py ++++ b/pipenv/vendor/pythonfinder/models/mixins.py +@@ -5,7 +5,7 @@ import abc + import operator + from collections import defaultdict + +-import attr ++from pipenv.vendor import attr + import six + + from ..compat import fs_str +diff --git a/pipenv/vendor/pythonfinder/models/path.py b/pipenv/vendor/pythonfinder/models/path.py +index b855a05d..a8070c91 100644 +--- a/pipenv/vendor/pythonfinder/models/path.py ++++ b/pipenv/vendor/pythonfinder/models/path.py +@@ -7,7 +7,7 @@ import sys + from collections import defaultdict + from itertools import chain + +-import attr ++from pipenv.vendor import attr + import six + from cached_property import cached_property + from ..compat import Path, fs_str +diff --git a/pipenv/vendor/pythonfinder/models/python.py b/pipenv/vendor/pythonfinder/models/python.py +index 619e7761..ff249be2 100644 +--- a/pipenv/vendor/pythonfinder/models/python.py ++++ b/pipenv/vendor/pythonfinder/models/python.py +@@ -7,7 +7,7 @@ import platform + import sys + from collections import defaultdict + +-import attr ++from pipenv.vendor import attr + import six + from packaging.version import Version + +diff --git a/pipenv/vendor/pythonfinder/models/windows.py b/pipenv/vendor/pythonfinder/models/windows.py +index a0e69b03..39353cdb 100644 +--- a/pipenv/vendor/pythonfinder/models/windows.py ++++ b/pipenv/vendor/pythonfinder/models/windows.py +@@ -4,7 +4,7 @@ from __future__ import absolute_import, print_function + import operator + from collections import defaultdict + +-import attr ++from pipenv.vendor import attr + + from ..environment import MYPY_RUNNING + from ..exceptions import InvalidPythonVersion +diff --git a/pipenv/vendor/pythonfinder/utils.py b/pipenv/vendor/pythonfinder/utils.py +index 8150545c..ef48e628 100644 +--- a/pipenv/vendor/pythonfinder/utils.py ++++ b/pipenv/vendor/pythonfinder/utils.py +@@ -10,7 +10,7 @@ from collections import OrderedDict + from fnmatch import fnmatch + from threading import Timer + +-import attr ++from pipenv.vendor import attr + import six + from packaging.version import LegacyVersion, Version + diff --git a/tasks/vendoring/patches/vendor/pythonfinder-pathlib-import.patch b/tasks/vendoring/patches/vendor/pythonfinder-pathlib-import.patch deleted file mode 100644 index 89cad03792..0000000000 --- a/tasks/vendoring/patches/vendor/pythonfinder-pathlib-import.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/pipenv/vendor/pythonfinder/compat.py b/pipenv/vendor/pythonfinder/compat.py -index 6fb4542f..d76c4efc 100644 ---- a/pipenv/vendor/pythonfinder/compat.py -+++ b/pipenv/vendor/pythonfinder/compat.py -@@ -4,7 +4,7 @@ import sys - import six - - if sys.version_info[:2] <= (3, 4): -- from pathlib2 import Path # type: ignore # noqa -+ from pipenv.vendor.pathlib2 import Path # type: ignore # noqa - else: - from pathlib import Path - diff --git a/tasks/vendoring/patches/vendor/update-attrs-import-path.patch b/tasks/vendoring/patches/vendor/update-attrs-import-path.patch index cf2968971f..d813371578 100644 --- a/tasks/vendoring/patches/vendor/update-attrs-import-path.patch +++ b/tasks/vendoring/patches/vendor/update-attrs-import-path.patch @@ -11,71 +11,6 @@ index f6e037d6..c7807c05 100644 import packaging.markers import packaging.utils import plette -diff --git a/pipenv/vendor/pythonfinder/models/mixins.py b/pipenv/vendor/pythonfinder/models/mixins.py -index 76327115..aeba0443 100644 ---- a/pipenv/vendor/pythonfinder/models/mixins.py -+++ b/pipenv/vendor/pythonfinder/models/mixins.py -@@ -5,7 +5,7 @@ import abc - import operator - from collections import defaultdict - --import attr -+from pipenv.vendor import attr - import six - - from ..compat import fs_str -diff --git a/pipenv/vendor/pythonfinder/models/path.py b/pipenv/vendor/pythonfinder/models/path.py -index b855a05d..a8070c91 100644 ---- a/pipenv/vendor/pythonfinder/models/path.py -+++ b/pipenv/vendor/pythonfinder/models/path.py -@@ -7,7 +7,7 @@ import sys - from collections import defaultdict - from itertools import chain - --import attr -+from pipenv.vendor import attr - import six - from cached_property import cached_property - from ..compat import Path, fs_str -diff --git a/pipenv/vendor/pythonfinder/models/python.py b/pipenv/vendor/pythonfinder/models/python.py -index 619e7761..ff249be2 100644 ---- a/pipenv/vendor/pythonfinder/models/python.py -+++ b/pipenv/vendor/pythonfinder/models/python.py -@@ -7,7 +7,7 @@ import platform - import sys - from collections import defaultdict - --import attr -+from pipenv.vendor import attr - import six - from packaging.version import Version - -diff --git a/pipenv/vendor/pythonfinder/models/windows.py b/pipenv/vendor/pythonfinder/models/windows.py -index a0e69b03..39353cdb 100644 ---- a/pipenv/vendor/pythonfinder/models/windows.py -+++ b/pipenv/vendor/pythonfinder/models/windows.py -@@ -4,7 +4,7 @@ from __future__ import absolute_import, print_function - import operator - from collections import defaultdict - --import attr -+from pipenv.vendor import attr - - from ..environment import MYPY_RUNNING - from ..exceptions import InvalidPythonVersion -diff --git a/pipenv/vendor/pythonfinder/utils.py b/pipenv/vendor/pythonfinder/utils.py -index 8150545c..ef48e628 100644 ---- a/pipenv/vendor/pythonfinder/utils.py -+++ b/pipenv/vendor/pythonfinder/utils.py -@@ -10,7 +10,7 @@ from collections import OrderedDict - from fnmatch import fnmatch - from threading import Timer - --import attr -+from pipenv.vendor import attr - import six - from packaging.version import LegacyVersion, Version - diff --git a/pipenv/vendor/requirementslib/models/dependencies.py b/pipenv/vendor/requirementslib/models/dependencies.py index 2608479a..1a610ce7 100644 --- a/pipenv/vendor/requirementslib/models/dependencies.py @@ -205,7 +140,7 @@ index 3d5743e6..b0c98de8 100644 +from pipenv.vendor import attr import pip_shims.shims from orderedmultidict import omdict - from six.moves.urllib.parse import quote_plus, unquote_plus + from six.moves.urllib.parse import quote, unquote_plus, unquote as url_unquote diff --git a/pipenv/vendor/requirementslib/models/vcs.py b/pipenv/vendor/requirementslib/models/vcs.py index 0f96a331..273305db 100644 --- a/pipenv/vendor/requirementslib/models/vcs.py