-
Notifications
You must be signed in to change notification settings - Fork 4
/
check-deps.py
executable file
·51 lines (34 loc) · 1.15 KB
/
check-deps.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python3
from typing import List, Set, Any, Optional, Tuple
import sys
import toml
from pprint import pprint
def _find_difference(left: Set[Any], right: Set[Any]) -> Optional[Tuple[Set[Any], Set[Any]]]:
left_only = left - right
right_only = right - left
if left_only or right_only:
return left_only, right_only
return None
def main() -> int:
with open("pyproject.toml") as f:
data = toml.load(f)
requires_extra = data["tool"]["flit"]["metadata"]["requires-extra"]
deps = set()
for k, v in requires_extra.items():
if k == "all":
continue
deps.update(v)
extra_all_deps = set(requires_extra["all"])
diff = _find_difference(deps, extra_all_deps)
if diff:
extras_only, all_only = diff
print("Mismatched dependencies between individual extras and cloudsync[all]")
print("Individual features require:", deps)
print("[all] requires:", extra_all_deps)
print()
print("Missing from [all]:", extras_only)
print("Only in [all]", all_only)
return 1
return 0
if __name__ == "__main__":
sys.exit(main())