Skip to content

Commit

Permalink
Fix click v7 version_option compatibility (#1410)
Browse files Browse the repository at this point in the history
It looks like the ternary was committed backwards in #1400, since the `package_name` option was add in click 8, but is only being passed in click 7. That caused `pip-tools` to error on import when installed alongside click 7.
  • Loading branch information
FuegoFro committed Jun 9, 2021
1 parent 6ed9301 commit 32a8834
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion piptools/scripts/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
METADATA_FILENAMES = frozenset({"setup.py", "setup.cfg", "pyproject.toml"})

# TODO: drop click 7 and remove this block, pass directly to version_option
version_option_kwargs = {} if IS_CLICK_VER_8_PLUS else {"package_name": "pip-tools"}
version_option_kwargs = {"package_name": "pip-tools"} if IS_CLICK_VER_8_PLUS else {}


def _get_default_option(option_name: str) -> Any:
Expand Down
2 changes: 1 addition & 1 deletion piptools/scripts/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
DEFAULT_REQUIREMENTS_FILE = "requirements.txt"

# TODO: drop click 7 and remove this block, pass directly to version_option
version_option_kwargs = {} if IS_CLICK_VER_8_PLUS else {"package_name": "pip-tools"}
version_option_kwargs = {"package_name": "pip-tools"} if IS_CLICK_VER_8_PLUS else {}


@click.command(context_settings={"help_option_names": ("-h", "--help")})
Expand Down

0 comments on commit 32a8834

Please sign in to comment.