20 lines
389 B
Python
20 lines
389 B
Python
Import("env")
|
|
|
|
import subprocess
|
|
|
|
|
|
def git(*args):
|
|
try:
|
|
return subprocess.check_output(
|
|
["git"] + list(args), stderr=subprocess.DEVNULL
|
|
).strip().decode("ascii")
|
|
except Exception:
|
|
return None
|
|
|
|
# count number of commits.
|
|
build_number = git("rev-list", "--count", "HEAD") or "0"
|
|
|
|
env.Append(BUILD_FLAGS=[
|
|
"-DBUILD_NUMBER=%s" % build_number
|
|
])
|