mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Merge pull request #4287 from pypa/bugfix/4286
Add missing import and fix function calls in cli
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Corrected a missing exception import and invalid function call invocations in ``pipenv.cli.command``.
|
||||
@@ -9,6 +9,7 @@ from click import (
|
||||
)
|
||||
|
||||
from ..__version__ import __version__
|
||||
from ..exceptions import PipenvOptionsError
|
||||
from ..patched import crayons
|
||||
from ..vendor import click_completion, delegator
|
||||
from .options import (
|
||||
@@ -298,6 +299,7 @@ def uninstall(
|
||||
if retcode:
|
||||
sys.exit(retcode)
|
||||
|
||||
|
||||
LOCK_HEADER = """\
|
||||
#
|
||||
# These requirements were autogenerated by pipenv
|
||||
@@ -307,11 +309,13 @@ LOCK_HEADER = """\
|
||||
#
|
||||
"""
|
||||
|
||||
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
|
||||
@@ -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(
|
||||
@@ -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."
|
||||
|
||||
Reference in New Issue
Block a user