Page MenuHomeSoftware Heritage

cli: Don't crash when subcommands fail importing
ClosedPublic

Authored by olasd on Wed, Nov 6, 2:47 PM.

Details

Summary

This is an issue when swh.model is installed but not dulwich: swh.model.cli
imports dulwich unconditionally, so /usr/bin/swh fails for all subcommands
instead of just ignoring the issue.

Test Plan
python3 -m venv cli-fail
. ./cli-fail/bin/activate
pip install swh.core swh.model
./cli-fail/bin/swh

Doesn't fail with ModuleNotFoundError: No module named 'dulwich'

Diff Detail

Repository
rDCORE Foundations and core functionalities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

olasd created this revision.Wed, Nov 6, 2:47 PM
olasd edited the test plan for this revision. (Show Details)Wed, Nov 6, 2:48 PM
ardumont added inline comments.
swh/core/cli/__init__.py
57

.warning or else you will have a warning about it

ardumont accepted this revision.Wed, Nov 6, 3:00 PM
This revision is now accepted and ready to land.Wed, Nov 6, 3:00 PM
olasd updated this revision to Diff 7671.Wed, Nov 6, 3:38 PM
olasd marked an inline comment as done.

rebase

This revision was automatically updated to reflect the committed changes.