1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2026-02-11 07:03:07 +01:00

#111: allow to add extra scripts with custom_script

This commit is contained in:
wellenvogel
2025-09-29 09:35:14 +02:00
parent 6266f85db6
commit 8bf8ada30e
4 changed files with 56 additions and 0 deletions

View File

@@ -547,3 +547,16 @@ env.Append(
)
#script does not run on clean yet - maybe in the future
env.AddPostAction("clean",cleangenerated)
extraScripts=getFileList(getOption(env,'custom_script',toArray=True))
for script in extraScripts:
if os.path.isfile(script):
print(f"#extra {script}")
with open(script) as fh:
try:
code = compile(fh.read(), script, 'exec')
except SyntaxError as e:
print(f"#ERROR: script {script} does not compile: {e}")
continue
exec(code)
else:
print(f"#ERROR: script {script} not found")