Merge pull request #4302 from pypa/vendors/update

This commit is contained in:
Dan Ryan
2020-06-01 11:17:07 -04:00
committed by GitHub
16 changed files with 133 additions and 148 deletions
+4
View File
@@ -0,0 +1,4 @@
- Updated vendored dependencies:
- **pythonfinder**: ``1.2.2`` => ``1.2.4``
- **requirementslib**: ``1.5.9`` => ``1.5.10``
-21
View File
@@ -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.
+1 -1
View File
@@ -10,7 +10,7 @@ from .exceptions import InvalidPythonVersion
from .models import SystemPath, WindowsFinder
from .pythonfinder import Finder
__version__ = "1.2.2"
__version__ = "1.2.4"
logger = logging.getLogger(__name__)
-1
View File
@@ -27,7 +27,6 @@ from ..utils import (
Sequence,
dedup,
ensure_path,
expand_paths,
filter_pythons,
is_in_path,
normalize_path,
+3 -4
View File
@@ -18,6 +18,7 @@ from ..utils import (
RE_MATCHER,
_filter_none,
ensure_path,
expand_paths,
get_python_version,
guess_company,
is_in_path,
@@ -286,12 +287,10 @@ class PythonFinder(BaseFinder, BasePath):
]
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
+4 -1
View File
@@ -42,7 +42,10 @@ class WindowsFinder(BaseFinder):
)
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,
+4 -2
View File
@@ -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
+1 -1
View File
@@ -10,7 +10,7 @@ from .models.lockfile import Lockfile
from .models.pipfile import Pipfile
from .models.requirements import Requirement
__version__ = "1.5.9"
__version__ = "1.5.10"
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -1013,7 +1013,7 @@ class Line(object):
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
+24 -25
View File
@@ -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 @@ class Analyzer(ast.NodeVisitor):
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 @@ class Analyzer(ast.NodeVisitor):
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 @@ class Analyzer(ast.NodeVisitor):
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 @@ build-backend = "{1}"
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:
+9 -9
View File
@@ -4,7 +4,7 @@ from __future__ import absolute_import, print_function
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 @@ class URI(object):
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 @@ class URI(object):
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 @@ class URI(object):
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 @@ class URI(object):
# 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
+3 -3
View File
@@ -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
@@ -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
@@ -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
@@ -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