cleepcli 1.49.7__tar.gz → 1.49.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cleepcli-1.49.7/cleepcli.egg-info → cleepcli-1.49.8}/PKG-INFO +1 -1
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/pico.py +67 -2
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/version.py +1 -1
- {cleepcli-1.49.7 → cleepcli-1.49.8/cleepcli.egg-info}/PKG-INFO +1 -1
- {cleepcli-1.49.7 → cleepcli-1.49.8}/tests/test_pico.py +31 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/LICENSE +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/MANIFEST.in +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/README.md +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/bin/ccli +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/bin/cleep-cli +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/__init__.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/check.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/ci.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/cleepapi.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/config.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/console.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/docs.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/file.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/git.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/module.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/package.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/systemd/cleep-watch.service +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/test.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/tools.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/watch.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli/watchsvc.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli.egg-info/SOURCES.txt +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli.egg-info/dependency_links.txt +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli.egg-info/requires.txt +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/cleepcli.egg-info/top_level.txt +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/pyproject.toml +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/requirements.txt +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/setup.cfg +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/setup.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/tests/test_check.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/tests/test_config.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/tests/test_console.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/tests/test_coverage.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/tests/test_docs_breaking.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/tests/test_file_sync_all.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/tests/test_module_scaffold.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/tests/test_watch.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.49.8}/tests/test_watchsvc.py +0 -0
|
@@ -135,6 +135,62 @@ class Pico:
|
|
|
135
135
|
and self._arm_lib_ok("libg.a")
|
|
136
136
|
)
|
|
137
137
|
|
|
138
|
+
def _toolchain_fingerprint(self) -> str:
|
|
139
|
+
"""Stable id for the apt toolchain (path + dumpversion)."""
|
|
140
|
+
gcc = shutil.which("arm-none-eabi-gcc") or ""
|
|
141
|
+
cmake = shutil.which("cmake") or ""
|
|
142
|
+
gcc_ver = ""
|
|
143
|
+
if gcc:
|
|
144
|
+
try:
|
|
145
|
+
gcc_ver = subprocess.check_output(
|
|
146
|
+
[gcc, "-dumpversion"],
|
|
147
|
+
text=True,
|
|
148
|
+
stderr=subprocess.DEVNULL,
|
|
149
|
+
).strip()
|
|
150
|
+
except (OSError, subprocess.CalledProcessError):
|
|
151
|
+
gcc_ver = ""
|
|
152
|
+
return "%s|%s|%s" % (gcc, gcc_ver, cmake)
|
|
153
|
+
|
|
154
|
+
def _cmake_env_path(self, build_root: str) -> str:
|
|
155
|
+
return os.path.join(build_root, "cmake-env.json")
|
|
156
|
+
|
|
157
|
+
def _build_cmake_env(self, *, board: str, sdk: dict[str, Any]) -> dict[str, Any]:
|
|
158
|
+
return {
|
|
159
|
+
"pico_board": board,
|
|
160
|
+
"sdk_path": config.PICO_SDK_DIR,
|
|
161
|
+
"sdk_revision": sdk.get("revision") or "",
|
|
162
|
+
"sdk_version": sdk.get("version") or "",
|
|
163
|
+
"toolchain": self._toolchain_fingerprint(),
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
def _load_cmake_env(self, build_root: str) -> dict[str, Any] | None:
|
|
167
|
+
path = self._cmake_env_path(build_root)
|
|
168
|
+
if not os.path.isfile(path):
|
|
169
|
+
return None
|
|
170
|
+
try:
|
|
171
|
+
with open(path, "r", encoding="utf-8") as handle:
|
|
172
|
+
data = json.load(handle)
|
|
173
|
+
except (OSError, UnicodeDecodeError, json.JSONDecodeError):
|
|
174
|
+
return None
|
|
175
|
+
return data if isinstance(data, dict) else None
|
|
176
|
+
|
|
177
|
+
def _write_cmake_env(self, build_root: str, env: dict[str, Any]) -> None:
|
|
178
|
+
os.makedirs(build_root, exist_ok=True)
|
|
179
|
+
path = self._cmake_env_path(build_root)
|
|
180
|
+
with open(path, "w", encoding="utf-8") as handle:
|
|
181
|
+
json.dump(env, handle, indent=4, ensure_ascii=False, sort_keys=True)
|
|
182
|
+
handle.write("\n")
|
|
183
|
+
|
|
184
|
+
def _cmake_env_matches(
|
|
185
|
+
self, saved: dict[str, Any] | None, wanted: dict[str, Any]
|
|
186
|
+
) -> bool:
|
|
187
|
+
if not saved:
|
|
188
|
+
return False
|
|
189
|
+
for key in ("pico_board", "sdk_path", "sdk_revision", "toolchain"):
|
|
190
|
+
if saved.get(key) != wanted.get(key):
|
|
191
|
+
return False
|
|
192
|
+
return True
|
|
193
|
+
|
|
138
194
|
@staticmethod
|
|
139
195
|
def _disk_free_bytes(path: str) -> int:
|
|
140
196
|
"""Return free bytes on the filesystem that holds ``path`` (or its parent)."""
|
|
@@ -606,15 +662,23 @@ class Pico:
|
|
|
606
662
|
|
|
607
663
|
build_root = build_dir_path(source_dir)
|
|
608
664
|
cmake_dir = os.path.join(build_root, "cmake")
|
|
609
|
-
|
|
665
|
+
wanted_env = self._build_cmake_env(board=board, sdk=sdk)
|
|
666
|
+
saved_env = self._load_cmake_env(build_root)
|
|
667
|
+
need_clean = not self._cmake_env_matches(saved_env, wanted_env)
|
|
668
|
+
if need_clean and os.path.isdir(cmake_dir):
|
|
669
|
+
self.logger.info(
|
|
670
|
+
'Firmware "%s": cmake env changed — wiping build cache',
|
|
671
|
+
source["slug"],
|
|
672
|
+
)
|
|
610
673
|
shutil.rmtree(cmake_dir)
|
|
611
674
|
os.makedirs(cmake_dir, exist_ok=True)
|
|
612
675
|
|
|
613
676
|
self.logger.info(
|
|
614
|
-
'Building firmware "%s" (board=%s, version=%s)',
|
|
677
|
+
'Building firmware "%s" (board=%s, version=%s%s)',
|
|
615
678
|
source["slug"],
|
|
616
679
|
board,
|
|
617
680
|
data["version"],
|
|
681
|
+
", incremental" if not need_clean else ", clean",
|
|
618
682
|
)
|
|
619
683
|
configure = [
|
|
620
684
|
"cmake",
|
|
@@ -631,6 +695,7 @@ class Pico:
|
|
|
631
695
|
cwd=source_dir,
|
|
632
696
|
env=env,
|
|
633
697
|
)
|
|
698
|
+
self._write_cmake_env(build_root, wanted_env)
|
|
634
699
|
|
|
635
700
|
uf2_path = self._find_built_uf2(cmake_dir)
|
|
636
701
|
if not uf2_path:
|
|
@@ -120,6 +120,37 @@ class PicoSdkTests(unittest.TestCase):
|
|
|
120
120
|
self.pico.build_firmware("demo")
|
|
121
121
|
self.assertIn("not installed", str(ctx.exception))
|
|
122
122
|
|
|
123
|
+
def test_cmake_env_matches_board_sdk_toolchain(self):
|
|
124
|
+
wanted = {
|
|
125
|
+
"pico_board": "pico_w",
|
|
126
|
+
"sdk_path": "/sdk",
|
|
127
|
+
"sdk_revision": "abc",
|
|
128
|
+
"sdk_version": "2.1.1",
|
|
129
|
+
"toolchain": "gcc|8|cmake",
|
|
130
|
+
}
|
|
131
|
+
self.assertTrue(self.pico._cmake_env_matches(dict(wanted), wanted))
|
|
132
|
+
self.assertFalse(
|
|
133
|
+
self.pico._cmake_env_matches({**wanted, "pico_board": "pico"}, wanted)
|
|
134
|
+
)
|
|
135
|
+
self.assertFalse(
|
|
136
|
+
self.pico._cmake_env_matches({**wanted, "sdk_revision": "zzz"}, wanted)
|
|
137
|
+
)
|
|
138
|
+
self.assertFalse(self.pico._cmake_env_matches(None, wanted))
|
|
139
|
+
|
|
140
|
+
def test_cmake_env_roundtrip(self):
|
|
141
|
+
build_root = os.path.join(self.root, "fw-build")
|
|
142
|
+
env = {
|
|
143
|
+
"pico_board": "pico_w",
|
|
144
|
+
"sdk_path": "/sdk",
|
|
145
|
+
"sdk_revision": "deadbee",
|
|
146
|
+
"sdk_version": "2.1.1",
|
|
147
|
+
"toolchain": "gcc|8|cmake",
|
|
148
|
+
}
|
|
149
|
+
self.pico._write_cmake_env(build_root, env)
|
|
150
|
+
loaded = self.pico._load_cmake_env(build_root)
|
|
151
|
+
self.assertEqual(loaded, env)
|
|
152
|
+
self.assertTrue(self.pico._cmake_env_matches(loaded, env))
|
|
153
|
+
|
|
123
154
|
|
|
124
155
|
if __name__ == "__main__":
|
|
125
156
|
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|