join python scripts

This commit is contained in:
Christian 2020-05-07 00:48:50 +02:00
parent e152937798
commit 2adb9cf5a8
Signed by: exxess
GPG Key ID: 88ED5070FE0D5F23
3 changed files with 13 additions and 28 deletions

View File

@ -37,7 +37,7 @@ build_flags =
'-DINI_ROOM="${common.mqtt_room}"'
'-DINI_DEVICE="${common.mqtt_device}"'
'-DINI_VERSION="${common.firmware_version}"'
extra_scripts = pre:public_key.py
extra_scripts = pre:sign_and_upload.py
[env:serial]
upload_port = /dev/ttyUSB*
@ -47,4 +47,3 @@ monitor_speed = 115200
[env:web]
upload_protocol = custom
extra_scripts = pre:sign_and_upload.py

View File

@ -1,26 +0,0 @@
# ----------------------------------------------------------------------------
# "THE TSCHUNK LICENSE" (Revision 42):
# <christian@staudte.it> wrote this file. As long as you retain this notice
# you can do whatever you want with this stuff. If we meet some day, and you
# think this stuff is worth it, you can buy me a Tschunk in return.
# ----------------------------------------------------------------------------
import configparser
import sys
Import('env')
config = configparser.ConfigParser()
config.read("platformio.ini")
sign_cert = config.get('uploadconfig', 'sign_cert')
cert = ''
try:
with open(sign_cert, 'r') as f:
for line in f:
cert += line.replace("\n", " ")
env.Append(BUILD_FLAGS='\'-DPUBLIC_SIGN_KEY="' + cert + '"\'')
except FileNotFoundError:
sys.stderr.write("No public key for signing found! Continuing without update support!\n")
pass

View File

@ -6,6 +6,7 @@
# ----------------------------------------------------------------------------
import configparser
import sys
import requests
Import('env')
@ -18,6 +19,7 @@ version = config.get('common', 'firmware_version')
sign_prog = config.get('uploadconfig', 'sign_prog')
sign_key = config.get('uploadconfig', 'sign_key')
sign_cert = config.get('uploadconfig', 'sign_cert')
upl_url = config.get('uploadconfig', 'upl_url')
upl_token = config.get('uploadconfig', 'upl_token')
@ -44,3 +46,13 @@ def fw_publish(source, target, env):
print('Upload successful')
env.Replace(UPLOADCMD=fw_publish)
cert = ''
try:
with open(sign_cert, 'r') as f:
for line in f:
cert += line.replace("\n", " ")
env.Append(BUILD_FLAGS='\'-DPUBLIC_SIGN_KEY="' + cert + '"\'')
except FileNotFoundError:
sys.stderr.write("No public key for signing found! Continuing without update support!\n")
pass