Skip to content

Commit 7a7b342

Browse files
authored
Fix the --system without --deploy flag bug (#6297)
* Fix the --system without --deploy flag bug * add news fragment
1 parent 7984148 commit 7a7b342

File tree

3 files changed

+31
-13
lines changed

3 files changed

+31
-13
lines changed

news/6295.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix regression of ``2024.3.0`` when using the ``--system`` flag without ``--deploy`` flag.

pipenv/routines/install.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,19 @@ def handle_lockfile(
158158
style="red",
159159
)
160160
raise exceptions.DeployException
161-
handle_outdated_lockfile(
162-
project,
163-
packages,
164-
old_hash=old_hash,
165-
new_hash=new_hash,
166-
system=system,
167-
allow_global=allow_global,
168-
skip_lock=skip_lock,
169-
pre=pre,
170-
pypi_mirror=pypi_mirror,
171-
categories=categories,
172-
)
161+
elif not system:
162+
handle_outdated_lockfile(
163+
project,
164+
packages,
165+
old_hash=old_hash,
166+
new_hash=new_hash,
167+
system=system,
168+
allow_global=allow_global,
169+
skip_lock=skip_lock,
170+
pre=pre,
171+
pypi_mirror=pypi_mirror,
172+
categories=categories,
173+
)
173174
elif not project.lockfile_exists and not skip_lock:
174175
handle_missing_lockfile(project, system, allow_global, pre, pypi_mirror)
175176

@@ -305,7 +306,7 @@ def do_install(
305306
categories=pipfile_categories,
306307
skip_lock=skip_lock,
307308
)
308-
if not deploy:
309+
if not (deploy or system):
309310
new_packages, _ = handle_new_packages(
310311
project,
311312
packages,

tests/integration/test_install_basic.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,22 @@ def test_system_and_deploy_work(pipenv_instance_private_pypi):
376376
assert c.returncode == 0
377377

378378

379+
380+
@pytest.mark.cli
381+
@pytest.mark.deploy
382+
@pytest.mark.system
383+
def test_system_works(pipenv_instance_pypi):
384+
with pipenv_instance_pypi() as p:
385+
c = p.pipenv("install urllib3")
386+
assert c.returncode == 0
387+
c = p.pipenv("--rm")
388+
assert c.returncode == 0
389+
c = subprocess_run(["virtualenv", ".venv"])
390+
assert c.returncode == 0
391+
c = p.pipenv("install --system")
392+
assert c.returncode == 0
393+
394+
379395
@pytest.mark.basic
380396
@pytest.mark.install
381397
def test_install_creates_pipfile(pipenv_instance_pypi):

0 commit comments

Comments
 (0)