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

Refactor and allow some support of extra-index-urls again #5028

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 4 additions & 6 deletions pipenv/utils/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
translate_markers,
)
from .indexes import parse_indexes, prepare_pip_source_args
from .internet import _get_requests_session
from .internet import _get_requests_session, is_pypi_url
from .locking import format_requirement_for_lockfile, prepare_lockfile
from .shell import make_posix, subprocess_run, temp_environ
from .spinner import create_spinner
Expand Down Expand Up @@ -243,7 +243,8 @@ def parse_line(
raise ResolutionFailure(
f"Failed to resolve requirement from line: {line!s}"
)
if index:
# Apply index restriction when it is a non-pypi index, or when no extra indexes
if index and (not is_pypi_url(index) or not extra_index):
try:
index_lookup[req.normalized_name] = project.get_source(
url=index, refresh=True
Expand Down Expand Up @@ -744,10 +745,7 @@ def collect_hashes(self, ireq):
sources = list(
filter(lambda s: s.get("name") == self.index_lookup[ireq.name], sources)
)
if any(
"python.org" in source["url"] or "pypi.org" in source["url"]
for source in sources
):
if any(is_pypi_url(source["url"]) for source in sources):
hashes = self._get_hashes_from_pypi(ireq)
if hashes:
return hashes
Expand Down