|
9 | 9 |
|
10 | 10 | parser = argparse.ArgumentParser()
|
11 | 11 | group = parser.add_mutually_exclusive_group(required=True)
|
12 |
| -group.add_argument('--sources',action='store_true') |
13 |
| -group.add_argument('--family',action='store_true') |
| 12 | +group.add_argument("--sources", action="store_true") |
| 13 | +group.add_argument("--family", action="store_true") |
14 | 14 | args = parser.parse_args()
|
15 | 15 |
|
16 | 16 | with open(os.path.join("sources", "config.yaml")) as config:
|
17 |
| - data = config.read() |
| 17 | + data = config.read() |
18 | 18 |
|
19 | 19 | if args.family:
|
20 |
| - m = re.search(r"(?m)^familyName: (.*)", data) |
21 |
| - if m: |
22 |
| - print(m[1]) |
23 |
| - sys.exit(0) |
24 |
| - else: |
25 |
| - print("Could not determine family name from config file!") |
26 |
| - sys.exit(1) |
| 20 | + m = re.search(r"(?m)^familyName: (.*)", data) |
| 21 | + if m: |
| 22 | + print(m[1]) |
| 23 | + sys.exit(0) |
| 24 | + else: |
| 25 | + print("Could not determine family name from config file!") |
| 26 | + sys.exit(1) |
27 | 27 |
|
28 | 28 | toggle = False
|
29 | 29 | sources = []
|
30 | 30 | for line in data.splitlines():
|
31 |
| - if re.match("^sources:", line): |
32 |
| - toggle = True |
33 |
| - continue |
34 |
| - if toggle: |
35 |
| - m = re.match(r"^\s+-\s*(.*)", line) |
36 |
| - if m: |
37 |
| - sources.append("sources/"+m[1]) |
38 |
| - else: |
39 |
| - toggle = False |
| 31 | + if re.match("^sources:", line): |
| 32 | + toggle = True |
| 33 | + continue |
| 34 | + if toggle: |
| 35 | + m = re.match(r"^\s*-\s*(.*)", line) |
| 36 | + if m: |
| 37 | + sources.append("sources/" + m[1]) |
| 38 | + else: |
| 39 | + toggle = False |
40 | 40 | if sources:
|
41 |
| - print(" ".join(sources)) |
42 |
| - sys.exit(0) |
| 41 | + print(" ".join(sources)) |
| 42 | + sys.exit(0) |
43 | 43 | else:
|
44 |
| - print("Could not determine sources from config file!") |
45 |
| - sys.exit(1) |
| 44 | + print("Could not determine sources from config file!") |
| 45 | + sys.exit(1) |
0 commit comments