Rev 9370 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
9411 | Boppan | 1 | import shutil |
2 | |||
9370 | Boppan | 3 | def log(s, end = "\n"): |
4 | print(s, end = end, flush = True) |
||
5 | |||
9411 | Boppan | 6 | def require_tools(names): |
7 | assert(type(names) == list or type(names) == tuple) |
||
8 | for name in names: |
||
9 | assert(type(name) == str) |
||
9370 | Boppan | 10 | |
9411 | Boppan | 11 | not_found = [] |
12 | for name in names: |
||
13 | if shutil.which(name) is None: |
||
14 | not_found.append(name) |
||
15 | |||
16 | if len(not_found) != 0: |
||
17 | log("Sorry, I can't find some tools:") |
||
18 | for name in not_found: |
||
19 | print(f"- {name}") |
||
20 | exit(1) |
||
21 |