Skip to content

Commit 95e83a3

Browse files
committed
Add missing import and fix function calls in cli
- Add missing `PipenvOptionsError` import to `pipenv.cli.command` - Fix calls to `click.echo` (should be just `echo`) - Fixes #4286 Signed-off-by: Dan Ryan <[email protected]>
1 parent 472618c commit 95e83a3

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

news/4286.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Corrected a missing exception import and invalid function call invocations in ``pipenv.cli.command``.

pipenv/cli/command.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
)
1010

1111
from ..__version__ import __version__
12+
from ..exceptions import PipenvOptionsError
1213
from ..patched import crayons
1314
from ..vendor import click_completion, delegator
1415
from .options import (
@@ -298,6 +299,7 @@ def uninstall(
298299
if retcode:
299300
sys.exit(retcode)
300301

302+
301303
LOCK_HEADER = """\
302304
#
303305
# These requirements were autogenerated by pipenv
@@ -307,11 +309,13 @@ def uninstall(
307309
#
308310
"""
309311

310-
LOCK_DEV_NOTE="""\
312+
313+
LOCK_DEV_NOTE = """\
311314
# Note: in pipenv 2020.x, "--dev" changed to emit both default and development
312315
# requirements. To emit only development requirements, pass "--dev-only".
313316
"""
314317

318+
315319
@cli.command(short_help="Generates Pipfile.lock.", context_settings=CONTEXT_SETTINGS)
316320
@lock_options
317321
@pass_state
@@ -342,10 +346,10 @@ def lock(
342346
header_options.append("--dev-only")
343347
elif dev:
344348
header_options.append("--dev")
345-
click.echo(LOCK_HEADER.format(options=" ".join(header_options)))
349+
echo(LOCK_HEADER.format(options=" ".join(header_options)))
346350
# TODO: Emit pip-compile style header
347351
if dev and not dev_only:
348-
click.echo(LOCK_DEV_NOTE)
352+
echo(LOCK_DEV_NOTE)
349353
# Setting "emit_requirements=True" means do_init() just emits the
350354
# install requirements file to stdout, it doesn't install anything
351355
do_init(
@@ -356,7 +360,7 @@ def lock(
356360
pre=state.installstate.pre,
357361
)
358362
elif state.lockoptions.dev_only:
359-
raise exceptions.PipenvOptionsError(
363+
raise PipenvOptionsError(
360364
"--dev-only",
361365
"--dev-only is only permitted in combination with --requirements. "
362366
"Aborting."

0 commit comments

Comments
 (0)