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

pipenv lock -r respect pypi_mirror args #4200

Merged
merged 7 commits into from Apr 25, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions news/4199.behavior.rst
@@ -0,0 +1 @@
Make sure `pipenv lock -r --pypi-mirror {MIRROR_URL}` will respect the pypi-mirror in requirements output.
4 changes: 2 additions & 2 deletions pipenv/core.py
Expand Up @@ -796,7 +796,7 @@ def do_install_dependencies(
skip_lock=False,
concurrent=True,
requirements_dir=None,
pypi_mirror=False,
pypi_mirror=None,
Copy link
Member

Choose a reason for hiding this comment

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

This probably shouldn't need to change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why the pypi_mirror becoms False default here but None in the rest parts of codes?

Copy link
Member

Choose a reason for hiding this comment

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

Most likely there is no good reason for this -- and apologies for not taking the time to look at it more closely! If, as you say, this is None everywhere else, and we don't differentiate in the function below (e.g. by checking if it's False) then it will be ok to make this change for consistency

):
""""
Executes the install functionality.
Expand Down Expand Up @@ -830,7 +830,7 @@ def do_install_dependencies(
no_deps = not skip_lock # skip_lock true, no_deps False, pip resolves deps
deps_list = list(lockfile.get_requirements(dev=dev, only=requirements))
if requirements:
index_args = prepare_pip_source_args(project.sources)
index_args = prepare_pip_source_args(get_source_list(pypi_mirror=pypi_mirror, project=project))
index_args = " ".join(index_args).replace(" -", "\n-")
deps = [
req.as_line(sources=False, include_hashes=False) for req in deps_list
Expand Down
4 changes: 1 addition & 3 deletions tests/integration/test_lock.py
Expand Up @@ -379,10 +379,8 @@ def test_private_index_mirror_lock_requirements(PipenvInstance_NoPyPI):
assert c.return_code == 0
c = p.pipenv('lock -r --pypi-mirror {0}'.format(mirror_url))
assert c.return_code == 0
assert '-i https://pypi.org/simple' in c.out.strip()
assert '-i {0}'.format(mirror_url) in c.out.strip()
assert '--extra-index-url https://test.pypi.org/simple' in c.out.strip()
# Mirror url should not have replaced source URLs
assert '-i {0}'.format(mirror_url) not in c.out.strip()
assert '--extra-index-url {}'.format(mirror_url) not in c.out.strip()


Expand Down