mirror of https://github.com/lumapu/ahoy.git
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.
31 lines
772 B
31 lines
772 B
2 years ago
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||
|
#
|
||
|
# Copyright (C) 2022 Thomas Basler and others
|
||
|
#
|
||
|
import pkg_resources
|
||
|
|
||
|
Import("env")
|
||
|
|
||
|
required_pkgs = {'dulwich'}
|
||
|
installed_pkgs = {pkg.key for pkg in pkg_resources.working_set}
|
||
|
missing_pkgs = required_pkgs - installed_pkgs
|
||
|
|
||
|
if missing_pkgs:
|
||
2 years ago
|
env.Execute('"$PYTHONEXE" -m pip install dulwich')
|
||
2 years ago
|
|
||
|
from dulwich import porcelain
|
||
|
|
||
|
def get_firmware_specifier_build_flag():
|
||
2 years ago
|
try:
|
||
2 years ago
|
build_version = porcelain.describe('../') # refers to the repository root dir
|
||
2 years ago
|
except:
|
||
|
build_version = "g0000000"
|
||
|
|
||
2 years ago
|
build_flag = "-D AUTO_GIT_HASH=\\\"" + build_version[1:] + "\\\""
|
||
2 years ago
|
print ("Firmware Revision: " + build_version)
|
||
|
return (build_flag)
|
||
|
|
||
|
env.Append(
|
||
|
BUILD_FLAGS=[get_firmware_specifier_build_flag()]
|
||
|
)
|