chore: branch setup — version.txt, platformio.ini envs, qio_qspi
This commit is contained in:
parent
7b583c4a67
commit
a371e29058
4 changed files with 58 additions and 6 deletions
27
tools/pio_version_pre.py
Executable file
27
tools/pio_version_pre.py
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Pre-build: generate src/version.h from version.txt so the firmware
|
||||
uses the single source of truth for version numbers."""
|
||||
Import("env")
|
||||
import os
|
||||
|
||||
project_dir = env.subst("$PROJECT_DIR")
|
||||
ver_file = os.path.join(project_dir, "version.txt")
|
||||
out_file = os.path.join(project_dir, "src", "version.h")
|
||||
|
||||
versions = {}
|
||||
with open(ver_file) as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if "=" in line:
|
||||
k, v = line.split("=", 1)
|
||||
versions[k.strip()] = v.strip()
|
||||
|
||||
header = f"""// Auto-generated from version.txt — DO NOT EDIT
|
||||
#define FIRMWARE_VERSION_SERVER "{versions['server']}"
|
||||
#define FIRMWARE_VERSION_CLIENT "{versions['client']}"
|
||||
"""
|
||||
|
||||
with open(out_file, "w") as f:
|
||||
f.write(header)
|
||||
|
||||
print(f" versions: server={versions['server']} client={versions['client']} -> src/version.h")
|
||||
Loading…
Reference in a new issue