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

Solve issue with quiet lock not writing the lock file. #6208

Merged
merged 2 commits into from
Aug 19, 2024
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
1 change: 1 addition & 0 deletions news/6207.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Solve issue with quiet lock not writing the lock file #6207.
3 changes: 2 additions & 1 deletion pipenv/cli/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ def lock(ctx, state, **kwargs):
clear=state.clear,
pre=pre,
pypi_mirror=state.pypi_mirror,
write=not state.quiet,
write=True,
quiet=state.quiet,
categories=state.installstate.categories,
)

Expand Down
38 changes: 20 additions & 18 deletions pipenv/routines/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def do_lock(
clear=False,
pre=False,
write=True,
quiet=False,
pypi_mirror=None,
categories=None,
extra_pip_args=None,
Expand Down Expand Up @@ -46,15 +47,15 @@ def do_lock(
packages = project.get_pipfile_section(pipfile_category)

if write:
# Alert the user of progress.
click.echo(
"{} {} {}".format(
click.style("Locking"),
click.style(f"[{pipfile_category}]", fg="yellow"),
click.style("dependencies..."),
),
err=True,
)
if not quiet: # Alert the user of progress.
click.echo(
"{} {} {}".format(
click.style("Locking"),
click.style(f"[{pipfile_category}]", fg="yellow"),
click.style("dependencies..."),
),
err=True,
)

# Prune old lockfile category as new one will be created.
with contextlib.suppress(KeyError):
Expand Down Expand Up @@ -89,15 +90,16 @@ def do_lock(
if write:
lockfile.update({"_meta": project.get_lockfile_meta()})
project.write_lockfile(lockfile)
click.echo(
"{}".format(
click.style(
f"Updated Pipfile.lock ({project.get_lockfile_hash()})!",
bold=True,
)
),
err=True,
)
if not quiet:
click.echo(
"{}".format(
click.style(
f"Updated Pipfile.lock ({project.get_lockfile_hash()})!",
bold=True,
)
),
err=True,
)
else:
return lockfile

Expand Down
Loading