diff --git a/news/4286.bugfix.rst b/news/4286.bugfix.rst new file mode 100644 index 0000000000..7852aad019 --- /dev/null +++ b/news/4286.bugfix.rst @@ -0,0 +1 @@ +Corrected a missing exception import and invalid function call invocations in ``pipenv.cli.command``. diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py index 718475b2ad..599b52390e 100644 --- a/pipenv/cli/command.py +++ b/pipenv/cli/command.py @@ -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 ( @@ -298,6 +299,7 @@ def uninstall( if retcode: sys.exit(retcode) + LOCK_HEADER = """\ # # These requirements were autogenerated by pipenv @@ -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 @@ -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."