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

Update vendor libraries #4302

Merged
merged 5 commits into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 4 additions & 0 deletions news/4302.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Updated vendored dependencies:

- **pythonfinder**: ``1.2.2`` => ``1.2.4``
- **requirementslib**: ``1.5.9`` => ``1.5.10``
21 changes: 0 additions & 21 deletions pipenv/vendor/pythonfinder/LICENSE

This file was deleted.

2 changes: 1 addition & 1 deletion pipenv/vendor/pythonfinder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
1 change: 0 additions & 1 deletion pipenv/vendor/pythonfinder/models/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
Sequence,
dedup,
ensure_path,
expand_paths,
filter_pythons,
is_in_path,
normalize_path,
Expand Down
7 changes: 3 additions & 4 deletions pipenv/vendor/pythonfinder/models/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
RE_MATCHER,
_filter_none,
ensure_path,
expand_paths,
get_python_version,
guess_company,
is_in_path,
Expand Down Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion pipenv/vendor/pythonfinder/models/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
21 changes: 0 additions & 21 deletions pipenv/vendor/pythonfinder/pep514tools.LICENSE

This file was deleted.

6 changes: 4 additions & 2 deletions pipenv/vendor/pythonfinder/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this from the last release? I think I forgot to update pythonfinder!

if p is None:
continue
for expanded in itertools.chain.from_iterable(
Expand All @@ -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


Expand Down
2 changes: 1 addition & 1 deletion pipenv/vendor/requirementslib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
2 changes: 1 addition & 1 deletion pipenv/vendor/requirementslib/models/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
49 changes: 24 additions & 25 deletions pipenv/vendor/requirementslib/models/setup_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glad to get this merged, so much nesting though!

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):
Expand Down Expand Up @@ -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()):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()):
Expand Down Expand Up @@ -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:
Expand Down
18 changes: 9 additions & 9 deletions pipenv/vendor/requirementslib/models/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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,
Expand All @@ -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
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions pipenv/vendor/vendor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the release in sync with master now? that's nice to know anyhow

plette==0.2.3
tomlkit==0.5.11
shellingham==1.3.2
six==1.14.0
Expand Down
Loading