|
19 | 19 | import sys
|
20 | 20 | import json
|
21 | 21 | import yaml
|
| 22 | +import pathlib |
| 23 | + |
| 24 | +tools_dir = pathlib.Path(__file__).resolve().parent |
| 25 | +top_dir = tools_dir.parent |
| 26 | + |
| 27 | +sys.path.insert(0, str(tools_dir / "adabot")) |
| 28 | +sys.path.insert(0, str(top_dir / "docs")) |
22 | 29 |
|
23 | 30 | import build_board_info
|
24 | 31 | from shared_bindings_matrix import get_settings_from_makefile
|
|
40 | 47 | "tools/ci_check_duplicate_usb_vid_pid.py",
|
41 | 48 | ]
|
42 | 49 |
|
43 |
| -changed_files = {} |
44 |
| -try: |
45 |
| - changed_files = json.loads(os.environ["CHANGED_FILES"]) |
46 |
| -except json.decoder.JSONDecodeError as exc: |
47 |
| - if exc.msg != "Expecting value": |
48 |
| - raise |
| 50 | +if len(sys.argv) > 1: |
| 51 | + print("Using files list on commandline") |
| 52 | + changed_files = sys.argv[1:] |
| 53 | +else: |
| 54 | + c = os.environ["CHANGED_FILES"] |
| 55 | + if c == "": |
| 56 | + print("CHANGED_FILES is in environment, but value is empty") |
| 57 | + changed_files = [] |
| 58 | + else: |
| 59 | + print("Using files list in CHANGED_FILES") |
| 60 | + changed_files = json.loads(os.environ["CHANGED_FILES"]) |
49 | 61 |
|
50 | 62 |
|
51 | 63 | def set_output(name, value):
|
52 | 64 | if "GITHUB_OUTPUT" in os.environ:
|
53 | 65 | with open(os.environ["GITHUB_OUTPUT"], "at") as f:
|
54 | 66 | print(f"{name}={value}", file=f)
|
55 | 67 | else:
|
56 |
| - print("Would set GitHub actions output {name} to '{value}'") |
| 68 | + print(f"Would set GitHub actions output {name} to '{value}'") |
57 | 69 |
|
58 | 70 |
|
59 | 71 | def set_boards_to_build(build_all):
|
@@ -114,7 +126,7 @@ def set_boards_to_build(build_all):
|
114 | 126 | for board in all_board_ids:
|
115 | 127 | if board not in board_settings:
|
116 | 128 | board_settings[board] = get_settings_from_makefile(
|
117 |
| - "../ports/" + board_to_port[board], board |
| 129 | + str(top_dir / "ports" / board_to_port[board]), board |
118 | 130 | )
|
119 | 131 | settings = board_settings[board]
|
120 | 132 |
|
|
0 commit comments