Skip to content

Commit 7f5adc2

Browse files
authored
install pioarduino core in penv (#254)
* install pioarduino core in penv * parse pioarduino core version from url
1 parent 355f503 commit 7f5adc2

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

builder/main.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
# Python dependencies required for the build process
5050
python_deps = {
5151
"uv": ">=0.1.0",
52-
"platformio": ">=6.1.18",
52+
"platformio": "https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.18.zip",
5353
"pyyaml": ">=6.0.2",
5454
"rich-click": ">=1.8.6",
5555
"zopfli": ">=0.2.2",
@@ -150,6 +150,17 @@ def get_packages_to_install(deps, installed_packages):
150150
for package, spec in deps.items():
151151
if package not in installed_packages:
152152
yield package
153+
elif package == "platformio":
154+
# Enforce the version from the direct URL if it looks like one.
155+
# If version can't be parsed, fall back to accepting any installed version.
156+
m = re.search(r'/v?(\d+\.\d+\.\d+(?:\.\d+)?)(?:\.(?:zip|tar\.gz|tar\.bz2))?$', spec)
157+
if m:
158+
expected_ver = semantic_version.Version(m.group(1))
159+
if installed_packages.get(package) != expected_ver:
160+
# Reinstall to align with the pinned URL version
161+
yield package
162+
else:
163+
continue
153164
else:
154165
version_spec = semantic_version.Spec(spec)
155166
if not version_spec.match(installed_packages[package]):
@@ -242,7 +253,13 @@ def _get_installed_uv_packages():
242253
packages_to_install = list(get_packages_to_install(python_deps, installed_packages))
243254

244255
if packages_to_install:
245-
packages_list = [f"{p}{python_deps[p]}" for p in packages_to_install]
256+
packages_list = []
257+
for p in packages_to_install:
258+
spec = python_deps[p]
259+
if spec.startswith(('http://', 'https://', 'git+', 'file://')):
260+
packages_list.append(spec)
261+
else:
262+
packages_list.append(f"{p}{spec}")
246263

247264
cmd = [
248265
uv_executable, "pip", "install",

0 commit comments

Comments
 (0)