cleepcli 1.49.7__tar.gz → 1.50.0__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.50.0}/PKG-INFO +1 -1
- {cleepcli-1.49.7 → cleepcli-1.50.0}/bin/ccli +27 -5
- {cleepcli-1.49.7 → cleepcli-1.50.0}/bin/cleep-cli +27 -5
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/config.py +61 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/pico.py +67 -2
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/version.py +1 -1
- {cleepcli-1.49.7 → cleepcli-1.50.0/cleepcli.egg-info}/PKG-INFO +1 -1
- cleepcli-1.50.0/tests/test_config.py +50 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/tests/test_pico.py +31 -0
- cleepcli-1.49.7/tests/test_config.py +0 -15
- {cleepcli-1.49.7 → cleepcli-1.50.0}/LICENSE +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/MANIFEST.in +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/README.md +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/__init__.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/check.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/ci.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/cleepapi.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/console.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/docs.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/file.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/git.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/module.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/package.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/systemd/cleep-watch.service +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/test.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/tools.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/watch.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli/watchsvc.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli.egg-info/SOURCES.txt +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli.egg-info/dependency_links.txt +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli.egg-info/requires.txt +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/cleepcli.egg-info/top_level.txt +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/pyproject.toml +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/requirements.txt +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/setup.cfg +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/setup.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/tests/test_check.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/tests/test_console.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/tests/test_coverage.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/tests/test_docs_breaking.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/tests/test_file_sync_all.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/tests/test_module_scaffold.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/tests/test_watch.py +0 -0
- {cleepcli-1.49.7 → cleepcli-1.50.0}/tests/test_watchsvc.py +0 -0
|
@@ -54,19 +54,31 @@ def get_core_mods(git=None, branch=None):
|
|
|
54
54
|
|
|
55
55
|
Args:
|
|
56
56
|
git (Git): Git instance. Create new instance if not provided
|
|
57
|
-
branch (str): branch
|
|
57
|
+
branch (str): optional branch/ref applied to every module (overrides
|
|
58
|
+
``mandatory-modules-branches.json`` when set)
|
|
58
59
|
|
|
59
60
|
Returns:
|
|
60
61
|
bool: True if modules installed successfully
|
|
61
62
|
"""
|
|
62
63
|
g = git or Git()
|
|
64
|
+
file_branches = {}
|
|
65
|
+
if branch is None:
|
|
66
|
+
file_branches = config.load_mandatory_module_branches()
|
|
67
|
+
if file_branches:
|
|
68
|
+
logging.info(
|
|
69
|
+
'Using per-module branches from %s',
|
|
70
|
+
config.MANDATORY_MODULES_BRANCHES_FILENAME,
|
|
71
|
+
)
|
|
63
72
|
|
|
64
73
|
for module in config.DEFAULT_MODULES:
|
|
74
|
+
mod_branch = branch if branch is not None else file_branches.get(module)
|
|
75
|
+
if mod_branch:
|
|
76
|
+
logging.info('Module "%s" -> branch "%s"', module, mod_branch)
|
|
65
77
|
module_path = os.path.join(config.MODULES_SRC, module)
|
|
66
78
|
if not os.path.exists(module_path):
|
|
67
|
-
res = g.clone_mod(module,
|
|
79
|
+
res = g.clone_mod(module, mod_branch)
|
|
68
80
|
else:
|
|
69
|
-
res = g.pull_mod(module,
|
|
81
|
+
res = g.pull_mod(module, mod_branch)
|
|
70
82
|
|
|
71
83
|
if not res:
|
|
72
84
|
logging.error('Error getting "%s" default module' % module)
|
|
@@ -976,10 +988,20 @@ def cimoddocpublish(module, version, ghtoken, ghowner, docfile):
|
|
|
976
988
|
@ci.command(hidden=True)
|
|
977
989
|
@click.pass_context
|
|
978
990
|
@click.option('--nosync', is_flag=True, default=False, help='Sync mods.')
|
|
979
|
-
@click.option(
|
|
991
|
+
@click.option(
|
|
992
|
+
'--branch',
|
|
993
|
+
default=None,
|
|
994
|
+
help=(
|
|
995
|
+
'Checkout this branch/ref for every mandatory module '
|
|
996
|
+
'(overrides mandatory-modules-branches.json in the Cleep repo)'
|
|
997
|
+
),
|
|
998
|
+
)
|
|
980
999
|
def cigetmods(ctx, nosync, branch):
|
|
981
1000
|
"""
|
|
982
|
-
Get all core modules from git repos
|
|
1001
|
+
Get all core modules from git repos.
|
|
1002
|
+
|
|
1003
|
+
Without --branch, each module uses the ref from
|
|
1004
|
+
mandatory-modules-branches.json at the Cleep repo root when present.
|
|
983
1005
|
"""
|
|
984
1006
|
if not get_core_mods(branch=branch):
|
|
985
1007
|
sys.exit(1)
|
|
@@ -54,19 +54,31 @@ def get_core_mods(git=None, branch=None):
|
|
|
54
54
|
|
|
55
55
|
Args:
|
|
56
56
|
git (Git): Git instance. Create new instance if not provided
|
|
57
|
-
branch (str): branch
|
|
57
|
+
branch (str): optional branch/ref applied to every module (overrides
|
|
58
|
+
``mandatory-modules-branches.json`` when set)
|
|
58
59
|
|
|
59
60
|
Returns:
|
|
60
61
|
bool: True if modules installed successfully
|
|
61
62
|
"""
|
|
62
63
|
g = git or Git()
|
|
64
|
+
file_branches = {}
|
|
65
|
+
if branch is None:
|
|
66
|
+
file_branches = config.load_mandatory_module_branches()
|
|
67
|
+
if file_branches:
|
|
68
|
+
logging.info(
|
|
69
|
+
'Using per-module branches from %s',
|
|
70
|
+
config.MANDATORY_MODULES_BRANCHES_FILENAME,
|
|
71
|
+
)
|
|
63
72
|
|
|
64
73
|
for module in config.DEFAULT_MODULES:
|
|
74
|
+
mod_branch = branch if branch is not None else file_branches.get(module)
|
|
75
|
+
if mod_branch:
|
|
76
|
+
logging.info('Module "%s" -> branch "%s"', module, mod_branch)
|
|
65
77
|
module_path = os.path.join(config.MODULES_SRC, module)
|
|
66
78
|
if not os.path.exists(module_path):
|
|
67
|
-
res = g.clone_mod(module,
|
|
79
|
+
res = g.clone_mod(module, mod_branch)
|
|
68
80
|
else:
|
|
69
|
-
res = g.pull_mod(module,
|
|
81
|
+
res = g.pull_mod(module, mod_branch)
|
|
70
82
|
|
|
71
83
|
if not res:
|
|
72
84
|
logging.error('Error getting "%s" default module' % module)
|
|
@@ -976,10 +988,20 @@ def cimoddocpublish(module, version, ghtoken, ghowner, docfile):
|
|
|
976
988
|
@ci.command(hidden=True)
|
|
977
989
|
@click.pass_context
|
|
978
990
|
@click.option('--nosync', is_flag=True, default=False, help='Sync mods.')
|
|
979
|
-
@click.option(
|
|
991
|
+
@click.option(
|
|
992
|
+
'--branch',
|
|
993
|
+
default=None,
|
|
994
|
+
help=(
|
|
995
|
+
'Checkout this branch/ref for every mandatory module '
|
|
996
|
+
'(overrides mandatory-modules-branches.json in the Cleep repo)'
|
|
997
|
+
),
|
|
998
|
+
)
|
|
980
999
|
def cigetmods(ctx, nosync, branch):
|
|
981
1000
|
"""
|
|
982
|
-
Get all core modules from git repos
|
|
1001
|
+
Get all core modules from git repos.
|
|
1002
|
+
|
|
1003
|
+
Without --branch, each module uses the ref from
|
|
1004
|
+
mandatory-modules-branches.json at the Cleep repo root when present.
|
|
983
1005
|
"""
|
|
984
1006
|
if not get_core_mods(branch=branch):
|
|
985
1007
|
sys.exit(1)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
|
+
import json
|
|
5
|
+
import logging
|
|
4
6
|
import os
|
|
5
7
|
from importlib.machinery import SourceFileLoader
|
|
6
8
|
try:
|
|
@@ -27,6 +29,9 @@ MODULES_REPO_URL = {
|
|
|
27
29
|
}
|
|
28
30
|
DEFAULT_MODULES = list(MODULES_REPO_URL.keys())
|
|
29
31
|
|
|
32
|
+
# Per-module git refs for cigetmods / core builds (in the Cleep core repo).
|
|
33
|
+
MANDATORY_MODULES_BRANCHES_FILENAME = "mandatory-modules-branches.json"
|
|
34
|
+
|
|
30
35
|
GITHUB_ORG = 'CleepDevice'
|
|
31
36
|
GITHUB_REPO = 'cleep'
|
|
32
37
|
GITHUB_REPO_DOCS = 'cleep-api-docs'
|
|
@@ -59,6 +64,62 @@ CORE_VERSION = get_core_version_from_sources(REPO_DIR)
|
|
|
59
64
|
|
|
60
65
|
CONFIG_DIR = '/etc/cleep'
|
|
61
66
|
|
|
67
|
+
|
|
68
|
+
def load_mandatory_module_branches(repo_dir=None):
|
|
69
|
+
"""
|
|
70
|
+
Load per-module branch/ref map from the Cleep core checkout.
|
|
71
|
+
|
|
72
|
+
File format (repo root)::
|
|
73
|
+
|
|
74
|
+
{
|
|
75
|
+
"audio": "master",
|
|
76
|
+
"cleepbus": "feature/foo",
|
|
77
|
+
...
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
repo_dir (str): Cleep core repo root (defaults to REPO_DIR)
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
dict: module name -> branch/ref string (only known mandatory modules)
|
|
85
|
+
"""
|
|
86
|
+
root = repo_dir if repo_dir is not None else REPO_DIR
|
|
87
|
+
path = os.path.join(root, MANDATORY_MODULES_BRANCHES_FILENAME)
|
|
88
|
+
if not os.path.isfile(path):
|
|
89
|
+
return {}
|
|
90
|
+
|
|
91
|
+
logger = logging.getLogger("cleepcli.config")
|
|
92
|
+
try:
|
|
93
|
+
with open(path, "r", encoding="utf-8") as handle:
|
|
94
|
+
data = json.load(handle)
|
|
95
|
+
except (OSError, ValueError) as error:
|
|
96
|
+
logger.error('Unable to read "%s": %s', path, error)
|
|
97
|
+
return {}
|
|
98
|
+
|
|
99
|
+
if not isinstance(data, dict):
|
|
100
|
+
logger.error(
|
|
101
|
+
'Invalid "%s": expected a JSON object of module -> branch', path
|
|
102
|
+
)
|
|
103
|
+
return {}
|
|
104
|
+
|
|
105
|
+
branches = {}
|
|
106
|
+
for key, value in data.items():
|
|
107
|
+
if key.startswith("$") or key.startswith("_"):
|
|
108
|
+
continue
|
|
109
|
+
if key not in MODULES_REPO_URL:
|
|
110
|
+
logger.warning(
|
|
111
|
+
'Ignoring unknown mandatory module "%s" in %s', key, path
|
|
112
|
+
)
|
|
113
|
+
continue
|
|
114
|
+
if not isinstance(value, str) or not value.strip():
|
|
115
|
+
logger.warning(
|
|
116
|
+
'Ignoring invalid branch for module "%s" in %s', key, path
|
|
117
|
+
)
|
|
118
|
+
continue
|
|
119
|
+
branches[key] = value.strip()
|
|
120
|
+
return branches
|
|
121
|
+
|
|
122
|
+
|
|
62
123
|
# Raspberry Pi Pico SDK (shared install for cleep-cli pico build)
|
|
63
124
|
PICO_SDK_DIR = '/var/opt/cleep/pico-sdk'
|
|
64
125
|
PICO_SDK_META = '/var/opt/cleep/pico-sdk.json'
|
|
@@ -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:
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
|
|
6
|
+
from cleepcli.config import (
|
|
7
|
+
MANDATORY_MODULES_BRANCHES_FILENAME,
|
|
8
|
+
get_core_version_from_sources,
|
|
9
|
+
load_mandatory_module_branches,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_get_core_version_from_sources(tmp_path):
|
|
14
|
+
pkg = tmp_path / "cleep"
|
|
15
|
+
pkg.mkdir()
|
|
16
|
+
(pkg / "__init__.py").write_text('__version__ = "0.2.0"\n')
|
|
17
|
+
assert get_core_version_from_sources(str(tmp_path)) == "0.2.0"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_get_core_version_from_sources_missing_returns_none(tmp_path):
|
|
21
|
+
assert get_core_version_from_sources(str(tmp_path)) is None
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_load_mandatory_module_branches_missing_file(tmp_path):
|
|
25
|
+
assert load_mandatory_module_branches(str(tmp_path)) == {}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def test_load_mandatory_module_branches_valid(tmp_path):
|
|
29
|
+
path = tmp_path / MANDATORY_MODULES_BRANCHES_FILENAME
|
|
30
|
+
path.write_text(
|
|
31
|
+
json.dumps(
|
|
32
|
+
{
|
|
33
|
+
"update": "feat/os-update",
|
|
34
|
+
"audio": "master",
|
|
35
|
+
"unknown": "nope",
|
|
36
|
+
"_comment": "ignored",
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
encoding="utf-8",
|
|
40
|
+
)
|
|
41
|
+
assert load_mandatory_module_branches(str(tmp_path)) == {
|
|
42
|
+
"update": "feat/os-update",
|
|
43
|
+
"audio": "master",
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_load_mandatory_module_branches_invalid_json(tmp_path):
|
|
48
|
+
path = tmp_path / MANDATORY_MODULES_BRANCHES_FILENAME
|
|
49
|
+
path.write_text("{not-json", encoding="utf-8")
|
|
50
|
+
assert load_mandatory_module_branches(str(tmp_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()
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
from cleepcli.config import get_core_version_from_sources
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def test_get_core_version_from_sources(tmp_path):
|
|
8
|
-
pkg = tmp_path / "cleep"
|
|
9
|
-
pkg.mkdir()
|
|
10
|
-
(pkg / "__init__.py").write_text('__version__ = "0.2.0"\n')
|
|
11
|
-
assert get_core_version_from_sources(str(tmp_path)) == "0.2.0"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def test_get_core_version_from_sources_missing_returns_none(tmp_path):
|
|
15
|
-
assert get_core_version_from_sources(str(tmp_path)) is None
|
|
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
|