Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7163557
D3930.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D3930.id.diff
View Options
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -67,8 +67,7 @@
swh=swh.core.cli:main
swh-db-init=swh.core.cli.db:db_init
[swh.cli.subcommands]
- db=swh.core.cli.db:db
- db-init=swh.core.cli.db:db_init
+ db=swh.core.cli.db
[pytest11]
pytest_swh_core = swh.core.pytest_plugin
""",
diff --git a/swh/core/cli/__init__.py b/swh/core/cli/__init__.py
--- a/swh/core/cli/__init__.py
+++ b/swh/core/cli/__init__.py
@@ -5,6 +5,7 @@
import logging
import logging.config
+import warnings
import click
import pkg_resources
@@ -117,7 +118,17 @@
for entry_point in pkg_resources.iter_entry_points("swh.cli.subcommands"):
try:
cmd = entry_point.load()
- swh.add_command(cmd, name=entry_point.name)
+ if isinstance(cmd, click.BaseCommand):
+ # for BW compat, auto add click commands
+ warnings.warn(
+ f"{entry_point.name}: automagic addition of click commands "
+ f"to the main swh group is deprecated",
+ DeprecationWarning,
+ )
+ swh.add_command(cmd, name=entry_point.name)
+ # otherwise it's expected to be a module which has been loaded
+ # it's the responsibility of the click commands/groups in this
+ # module to transitively have the main swh group as parent.
except Exception as e:
logger.warning("Could not load subcommand %s: %s", entry_point.name, str(e))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 30, 10:16 AM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3216011
Attached To
D3930: Do not automagically add click cmd from swh.cli.subcommands
Event Timeline
Log In to Comment