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

Add missing import and fix function calls in cli #4287

Merged
merged 3 commits into from
May 29, 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
1 change: 1 addition & 0 deletions news/4286.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Corrected a missing exception import and invalid function call invocations in ``pipenv.cli.command``.
12 changes: 8 additions & 4 deletions pipenv/cli/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
)

from ..__version__ import __version__
from ..exceptions import PipenvOptionsError
from ..patched import crayons
from ..vendor import click_completion, delegator
from .options import (
Expand Down Expand Up @@ -298,6 +299,7 @@ def uninstall(
if retcode:
sys.exit(retcode)


LOCK_HEADER = """\
#
# These requirements were autogenerated by pipenv
Expand All @@ -307,11 +309,13 @@ def uninstall(
#
"""

LOCK_DEV_NOTE="""\

LOCK_DEV_NOTE = """\
# Note: in pipenv 2020.x, "--dev" changed to emit both default and development
# requirements. To emit only development requirements, pass "--dev-only".
"""


@cli.command(short_help="Generates Pipfile.lock.", context_settings=CONTEXT_SETTINGS)
@lock_options
@pass_state
Expand Down Expand Up @@ -342,10 +346,10 @@ def lock(
header_options.append("--dev-only")
elif dev:
header_options.append("--dev")
click.echo(LOCK_HEADER.format(options=" ".join(header_options)))
echo(LOCK_HEADER.format(options=" ".join(header_options)))
# TODO: Emit pip-compile style header
if dev and not dev_only:
click.echo(LOCK_DEV_NOTE)
echo(LOCK_DEV_NOTE)
# Setting "emit_requirements=True" means do_init() just emits the
# install requirements file to stdout, it doesn't install anything
do_init(
Expand All @@ -356,7 +360,7 @@ def lock(
pre=state.installstate.pre,
)
elif state.lockoptions.dev_only:
raise exceptions.PipenvOptionsError(
raise PipenvOptionsError(
"--dev-only",
"--dev-only is only permitted in combination with --requirements. "
"Aborting."
Expand Down