-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathextra_script.py
More file actions
32 lines (26 loc) · 1.02 KB
/
Copy pathextra_script.py
File metadata and controls
32 lines (26 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
Pre-build script to patch LilyGoLib library.json with missing dependencies.
LilyGoLib doesn't declare TinyGPSPlus, NFC-RFAL-fork, ST25R3916-fork as
dependencies, causing PlatformIO LDF to fail resolving them.
"""
import os
import json
Import("env")
libdeps = os.path.join(env.subst("$PROJECT_LIBDEPS_DIR"), env.subst("$PIOENV"))
lilygo_json = os.path.join(libdeps, "LilyGoLib", "library.json")
if os.path.isfile(lilygo_json):
with open(lilygo_json) as f:
data = json.load(f)
deps = data.get("dependencies", [])
names = [d.get("name", "") for d in deps]
missing = ["TinyGPSPlus", "NFC-RFAL-fork", "ST25R3916-fork", "ESP8266Audio"]
changed = False
for lib in missing:
if lib not in names:
deps.append({"name": lib, "version": "*"})
changed = True
if changed:
data["dependencies"] = deps
with open(lilygo_json, "w") as f:
json.dump(data, f, indent=4)
print("[extra_script] Patched LilyGoLib library.json with missing dependencies")