* cleanup of `defines.h`
This commit is contained in:
lumapu 2024-04-05 00:34:52 +02:00
parent 5a32288536
commit 29adc76936
6 changed files with 68 additions and 62 deletions

View file

@ -27,11 +27,22 @@ def getFlagsOfEnv(env):
elif len(flags[i]) > 0:
build_flags = build_flags + [flags[i]]
def parseDefinesH():
global build_flags
pattern = r'^\s*#\s*define\s+(\w+)'
with open("defines.h", "r") as f:
for line in f:
match = re.match(pattern, line)
if match:
build_flags += [match.group(1)]
def get_build_flags():
getFlagsOfEnv("env:" + env['PIOENV'])
config = configparser.ConfigParser()
config.read('platformio.ini')
parseDefinesH()
# translate board
board = config["env:" + env['PIOENV']]['board']