Mirror of espurna firmware for wireless switches and more
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.

23 lines
596 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 = ""
  12. try:
  13. revision = "\\\"{}\\\"".format(git("rev-parse", "--short=8", "HEAD"))
  14. except: # pylint: disable=broad-except
  15. pass
  16. # Note: code expects this as undefined when empty
  17. if revision:
  18. env.Append(CPPDEFINES=[
  19. ("APP_REVISION", revision)
  20. ])