Page MenuHomeSoftware Heritage

cli: Don't crash when subcommands fail importing
ClosedPublic

Authored by olasd on Nov 6 2019, 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

ardumont added inline comments.
swh/core/cli/__init__.py
56

.warning or else you will have a warning about it

This revision is now accepted and ready to land.Nov 6 2019, 3:00 PM
olasd marked an inline comment as done.

rebase