From 361556a6a7913104c513c8f8029efe090267bb9f Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Fri, 16 Apr 2021 10:59:46 +0800 Subject: [PATCH] use sha in build filenames --- .gitignore | 2 +- bin/buildinfo.py | 8 ++------ bin/platformio-custom.py | 24 +++--------------------- 3 files changed, 6 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index d250737cb..67688a0b4 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,4 @@ Thumbs.db nanopb* flash.uf2 cmake-build* - +__pycache__ \ No newline at end of file diff --git a/bin/buildinfo.py b/bin/buildinfo.py index 803b5bc7e..36f88f43e 100755 --- a/bin/buildinfo.py +++ b/bin/buildinfo.py @@ -1,11 +1,7 @@ #!/usr/bin/env python3 import configparser +from readprops import readProps -config = configparser.RawConfigParser() -config.read('version.properties') - -version = dict(config.items('VERSION')) - -verStr = "{}.{}.{}".format(version["major"], version["minor"], version["build"]) +verStr = readProps('version.properties') print(f"{verStr}") diff --git a/bin/platformio-custom.py b/bin/platformio-custom.py index 2e95be809..ce811c9cb 100644 --- a/bin/platformio-custom.py +++ b/bin/platformio-custom.py @@ -4,32 +4,14 @@ import subprocess import configparser import traceback import sys +from readprops import readProps Import("projenv") prefsLoc = projenv["PROJECT_DIR"] + "/version.properties" -config = configparser.RawConfigParser() -config.read(prefsLoc) -version = dict(config.items('VERSION')) - -# Try to find current build SHA if if the workspace is clean. This could fail if git is not installed -try: - sha = subprocess.check_output( - ['git', 'rev-parse', '--short', 'HEAD']).decode("utf-8").strip() - isDirty = subprocess.check_output( - ['git', 'diff', 'HEAD']).decode("utf-8").strip() - suffix = sha - if isDirty: - suffix = sha + "-dirty" - verStr = "{}.{}.{}.{}".format( - version["major"], version["minor"], version["build"], suffix) -except: - print("Unexpected error:", sys.exc_info()[0]) - traceback.print_exc() - verStr = "{}.{}.{}".format( - version["major"], version["minor"], version["build"]) - +verStr = readProps(prefsLoc) print("Using meshtastic platform-custom.py, firmare version " + verStr) +# print("path is" + ','.join(sys.path)) # General options that are passed to the C and C++ compilers projenv.Append(CCFLAGS=[