Skip to content

Commit

Permalink
Merge pull request #4287 from pypa/bugfix/4286
Browse files Browse the repository at this point in the history
Add missing import and fix function calls in cli
  • Loading branch information
frostming authored May 29, 2020
2 parents b374f85 + 8b31934 commit f640fcb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
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

0 comments on commit f640fcb

Please sign in to comment.