Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7066362
D5466.id19539.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
988 B
Subscribers
None
D5466.id19539.diff
View Options
diff --git a/swh/model/cli.py b/swh/model/cli.py
--- a/swh/model/cli.py
+++ b/swh/model/cli.py
@@ -9,7 +9,15 @@
# WARNING: do not import unnecessary things here to keep cli startup time under
# control
-import click
+try:
+ import click
+except ImportError:
+ print(
+ "Cannot run swh-identify; the Click package is not installed."
+ "Did you install 'swh.model' instead of 'swh.model[cli]'?",
+ file=sys.stderr,
+ )
+ exit(1)
try:
from swh.core.cli import swh as swh_cli_group
@@ -101,7 +109,13 @@
def swhid_of_git_repo(path) -> CoreSWHID:
- import dulwich.repo
+ try:
+ import dulwich.repo
+ except ImportError:
+ raise click.ClickException(
+ "Cannot compute snapshot identifier; the Dulwich package is not installed. "
+ "Did you install 'swh.model' instead of 'swh.model[cli]'?"
+ )
from swh.model import hashutil
from swh.model.identifiers import snapshot_identifier
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Nov 5 2024, 6:38 AM (8 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3225455
Attached To
D5466: swh-identify: Hide tracebacks if Click or Dulwich is not installed
Event Timeline
Log In to Comment