Skip to content

Commit 8fad0a9

Browse files
committed
Try importing vendored libraries independently
Debian/Ubuntu removes the vendored `yaml` libary, but keeps `lexicon` and `fluidity`. Trying to import `lexicon` and `yaml` together will fail in this case: `yaml` is not available from the vendored directory and `lexicon` from the system. So try importing vendored libraries independently to allow replacing them individually.
1 parent 6a71e68 commit 8fad0a9

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

invoke/parser/parser.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33

44
try:
55
from ..vendor.lexicon import Lexicon
6-
from ..vendor.fluidity import StateMachine, state, transition
76
except ImportError:
87
from lexicon import Lexicon # type: ignore[no-redef]
8+
try:
9+
from ..vendor.fluidity import StateMachine, state, transition
10+
except ImportError:
911
from fluidity import ( # type: ignore[no-redef]
1012
StateMachine,
1113
state,

invoke/util.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
# more obvious. Requires packagers to leave invoke/vendor/__init__.py alone tho
2020
try:
2121
from .vendor.lexicon import Lexicon # noqa
22-
from .vendor import yaml # noqa
2322
except ImportError:
2423
from lexicon import Lexicon # type: ignore[no-redef] # noqa
24+
try:
25+
from .vendor import yaml # noqa
26+
except ImportError:
2527
import yaml # type: ignore[no-redef] # noqa
2628

2729

0 commit comments

Comments
 (0)