Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
679 B

  1. import os
  2. import subprocess
  3. def git(*args):
  4. cmd = ["git"]
  5. cmd.extend(args)
  6. proc = subprocess.Popen(
  7. cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True
  8. )
  9. return proc.stdout.readlines()[0].strip()
  10. def app_inject_revision(env):
  11. revision = env.get("ESPURNA_RELEASE_REVISION", "")
  12. if not revision:
  13. try:
  14. revision = ".git" + git("rev-parse", "--short=8", "HEAD")
  15. except: # pylint: disable=broad-except
  16. pass
  17. # Note: code expects this as undefined when empty
  18. if revision:
  19. env.Append(CPPDEFINES=[
  20. ("APP_REVISION", "\\\"{}\\\"".format(revision))
  21. ])