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

parse download event better for sdist on pip v20+ #51

Merged
merged 3 commits into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ sudo: false

python:
- "2.7"
- "3.6"
- "3.7-dev"
- "pypy"
- "pypy3.5"
- "3.7"
- "nightly"

matrix:
Expand Down
2 changes: 1 addition & 1 deletion johnnydep/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Display dependency tree of Python distribution"""

__version__ = "1.3"
__version__ = "1.4"
16 changes: 13 additions & 3 deletions johnnydep/pipper.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ def _get_wheel_args(index_url, env, extra_index_url):
"--no-cache-dir",
"--disable-pip-version-check",
]
if index_url is not None and index_url != DEFAULT_INDEX:
args += ["--index-url", index_url, "--trusted-host", urlparse(index_url).hostname]
if index_url is not None:
args += ["--index-url", index_url]
if index_url != DEFAULT_INDEX:
args += ["--trusted-host", urlparse(index_url).hostname]
if extra_index_url is not None:
args += ["--extra-index-url", extra_index_url, "--trusted-host", urlparse(extra_index_url).hostname]
if env is None:
Expand Down Expand Up @@ -124,7 +126,8 @@ def get(dist_name, index_url=None, env=None, extra_index_url=None, tmpdir=None):
log.debug("wheel command completed ok", dist_name=dist_name)
out = out.decode("utf-8")
links = []
for line in out.splitlines():
lines = out.splitlines()
for i, line in enumerate(lines):
line = line.strip()
if line.startswith("Downloading "):
parts = line.split()
Expand All @@ -133,6 +136,13 @@ def get(dist_name, index_url=None, env=None, extra_index_url=None, tmpdir=None):
link = parts[-2]
elif len(parts) == 4 and parts[-2].startswith("(") and last.endswith(")"):
link = parts[-3]
if not urlparse(link).scheme:
# newest pip versions have changed to not log the full url
# in the download event. it is becoming more and more annoying
# to preserve compatibility across a wide range of pip versions
next_line = lines[i + 1].strip()
if next_line.startswith("Added ") and " to build tracker" in next_line:
link = next_line.split(" to build tracker")[0].split()[-1]
else:
link = last
links.append(link)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="johnnydep",
version="1.3",
version="1.4",
description="Display dependency tree of Python distribution",
long_description=open("README.md").read(),
long_description_content_type='text/markdown',
Expand Down