Browse Source

pio: accept external revision string

mcspr-patch-1
Maxim Prokhorov 3 years ago
parent
commit
7817e3abd5
2 changed files with 8 additions and 6 deletions
  1. +7
    -6
      code/scripts/espurna_utils/git.py
  2. +1
    -0
      code/scripts/pio_pre.py

+ 7
- 6
code/scripts/espurna_utils/git.py View File

@ -10,14 +10,15 @@ def git(*args):
return proc.stdout.readlines()[0].strip()
def app_inject_revision(env):
revision = ""
try:
revision = "\\\"{}\\\"".format(git("rev-parse", "--short=8", "HEAD"))
except: # pylint: disable=broad-except
pass
revision = env.get("ESPURNA_RELEASE_REVISION", "")
if not revision:
try:
revision = git("rev-parse", "--short=8", "HEAD")
except: # pylint: disable=broad-except
pass
# Note: code expects this as undefined when empty
if revision:
env.Append(CPPDEFINES=[
("APP_REVISION", revision)
("APP_REVISION", "\\\"{}\\\"".format(revision))
])

+ 1
- 0
code/scripts/pio_pre.py View File

@ -115,6 +115,7 @@ else:
# handle `-t release` parameters
if CI:
env.Append(
ESPURNA_RELEASE_REVISION=os.environ.get("ESPURNA_RELEASE_REVISION", ""),
ESPURNA_RELEASE_NAME=os.environ.get("ESPURNA_RELEASE_NAME", ""),
ESPURNA_RELEASE_VERSION=os.environ.get("ESPURNA_RELEASE_VERSION", ""),
ESPURNA_RELEASE_DESTINATION=os.environ.get("ESPURNA_RELEASE_DESTINATION", ""),


Loading…
Cancel
Save