Skip to content

Commit 8348275

Browse files
committed
Bump dependency on click 8.2
Task groups need to be named explicitely because the group suffix is not implicitely removed. The test runner distinguishes between stderr and stdout now. The help page test was adjusted accordingly.
1 parent 7eedb71 commit 8348275

File tree

7 files changed

+25
-22
lines changed

7 files changed

+25
-22
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/bin/env python3
22

3-
from importlib.metadata import version
3+
from importlib import metadata
44

5-
from packaging.version import parse
5+
from packaging.version import Version
66

7-
click_version = version("click")
8-
9-
if parse(click_version) < parse("8.1.1") or parse(click_version) >= parse("8.2"):
10-
print("🚧 Linting with mypy is currently only supported with click~=8.1.1. 🚧")
11-
print("🔧 Please run `pip install click~=8.1.1` first. 🔨")
12-
exit(1)
7+
if __name__ == "__main__":
8+
click_version = Version(metadata.version("click"))
9+
if click_version < Version("8.1.1"):
10+
print("🚧 Linting with mypy is currently only supported with click>=8.1.1. 🚧")
11+
print("🔧 Please run `pip install click>=8.1.1` first. 🔨")
12+
exit(1)

CHANGES/+click_8.2.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add support for click 8.2.
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
#!/bin/env python3
22

3-
import click
4-
from packaging.version import parse
3+
from importlib import metadata
54

6-
if parse(click.__version__) < parse("8.1.1") or parse(click.__version__) >= parse("8.2"):
7-
print("🚧 Linting with mypy is currently only supported with click~=8.1.1. 🚧")
8-
print("🔧 Please run `pip install click~=8.1.1` first. 🔨")
9-
exit(1)
5+
from packaging.version import Version
6+
7+
if __name__ == "__main__":
8+
click_version = Version(metadata.version("click"))
9+
if click_version < Version("8.1.1"):
10+
print("🚧 Linting with mypy is currently only supported with click>=8.1.1. 🚧")
11+
print("🔧 Please run `pip install click>=8.1.1` first. 🔨")
12+
exit(1)

pulpcore/cli/core/task_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
_ = translation.gettext
2020

2121

22-
@pulp_group()
22+
@pulp_group(name="task-group")
2323
@pass_pulp_context
2424
@click.pass_context
2525
def task_group(ctx: click.Context, pulp_ctx: PulpCLIContext, /) -> None:

pulpcore/cli/rpm/prune.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@
3333
@multi_repository_option
3434
@click.option(
3535
"--all-repositories",
36-
type=bool,
3736
is_flag=True,
38-
show_default=True,
3937
default=False,
4038
help=_("Prune *all* repositories accessible to the invoking user."),
4139
)
@@ -47,9 +45,7 @@
4745
)
4846
@click.option(
4947
"--dry-run",
50-
type=bool,
5148
is_flag=True,
52-
show_default=True,
5349
default=False,
5450
help=_("Evaluate the prune-status of the specified repositories but DO NOT make any changes."),
5551
)
@@ -73,7 +69,6 @@ def prune_packages(
7369
7470
You may not specify --all-repositories *and* one or more specific repositories.
7571
"""
76-
prune_ctx = PulpRpmPruneContext(pulp_ctx)
7772
if not (all_repositories or repositories):
7873
raise PulpException(
7974
_("at least one --repository, or --all-repositories, must be specified")
@@ -87,5 +82,6 @@ def prune_packages(
8782
["*"] if all_repositories else list(repositories)
8883
)
8984

85+
prune_ctx = PulpRpmPruneContext(pulp_ctx)
9086
result = prune_ctx.prune_packages(repos_list, keep_days, dry_run)
9187
pulp_ctx.output_result(result)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ classifiers=[
2424
]
2525
dependencies = [
2626
"pulp-glue==0.33.0.dev",
27-
"click>=8.0.0,<8.2", # Proven to not do semver.
27+
"click>=8.0.0,<8.3", # Proven to not do semver.
2828
"PyYAML>=5.3,<6.1",
2929
"schema>=0.7.5,<0.8",
3030
"tomli>=2.0.0,<2.1;python_version<'3.11'",

tests/test_help_pages.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ def test_access_help(no_api: None, subtests: SubTests) -> None:
4848
result = runner.invoke(main, args + ["--help"], catch_exceptions=False)
4949

5050
if result.exit_code == 2:
51-
assert "not available in this context" in result.stdout
51+
assert (
52+
"not available in this context" in result.stdout
53+
or "not available in this context" in result.stderr
54+
)
5255
else:
5356
assert result.exit_code == 0
5457
assert result.stdout.startswith("Usage:") or result.stdout.startswith(

0 commit comments

Comments
 (0)