-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_release_script.py
executable file
·34 lines (26 loc) · 1.37 KB
/
create_release_script.py
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
33
34
import subprocess
from pathlib import Path
Import("env", "projenv")
result = subprocess.run(
['cat','./firmwareVersion'], stdout=subprocess.PIPE)
version = result.stdout.decode('utf-8').strip()
print("Version " + str(version))
print("Current CLI targets", COMMAND_LINE_TARGETS)
print("Current Build targets", BUILD_TARGETS)
#print(env.Dump())
def post_program_action(source, target, env):
print("Program has been built!")
program_path = target[0].get_abspath()
print("Program path", program_path)
# Use case: sign a firmware, do any manipulations with ELF, etc
# This is really specific to the ESP environemtn
projectpath = Path(env["PROJECT_PACKAGES_DIR"])
projectpathlength = len(projectpath.parents)
mkdir_command = "mkdir -p CineMatrixFirmware-"+version
cp_command = "cp .pio/build/esp32dev-prod/firmware.bin $PROJECT_PACKAGES_DIR/framework-arduinoespressif32/tools/sdk/esp32/bin/bootloader_dio_40m.bin " +\
"$PROJECT_PACKAGES_DIR/framework-arduinoespressif32/tools/partitions/boot_app0.bin .pio/build/esp32dev-prod/partitions.bin CineMatrixFirmware-"+version+"/"
tar_cmnd= "tar -cvzf $PROJECT_DIR/CineMatrixFirmware-"+version+".tar.gz ./CineMatrixFirmware-"+version
env.Execute(mkdir_command)
env.Execute(cp_command)
env.Execute(tar_cmnd)
env.AddPostAction(".pio/build/esp32dev-prod/firmware.bin", post_program_action)