🔨 Minor build script changes

This commit is contained in:
Scott Lahteine
2022-07-21 04:18:17 -05:00
parent c9445cfc41
commit 6e02f15dd6
4 changed files with 15 additions and 14 deletions

View File

@ -70,10 +70,9 @@ if pioutil.is_pio_build():
feat['lib_deps'] = list(filter(lib_re.match, feat['lib_deps'])) + [dep]
blab("[%s] lib_deps = %s" % (feature, dep), 3)
def load_config():
def load_features():
blab("========== Gather [features] entries...")
items = ProjectConfig().items('features')
for key in items:
for key in ProjectConfig().items('features'):
feature = key[0].upper()
if not feature in FEATURE_CONFIG:
FEATURE_CONFIG[feature] = { 'lib_deps': [] }
@ -81,8 +80,7 @@ if pioutil.is_pio_build():
# Add options matching custom_marlin.MY_OPTION to the pile
blab("========== Gather custom_marlin entries...")
all_opts = env.GetProjectOptions()
for n in all_opts:
for n in env.GetProjectOptions():
key = n[0]
mat = re.match(r'custom_marlin\.(.+)', key)
if mat:
@ -127,10 +125,10 @@ if pioutil.is_pio_build():
set_env_field('lib_ignore', lib_ignore)
def apply_features_config():
load_config()
load_features()
blab("========== Apply enabled features...")
for feature in FEATURE_CONFIG:
if not env.MarlinFeatureIsEnabled(feature):
if not env.MarlinHas(feature):
continue
feat = FEATURE_CONFIG[feature]
@ -212,7 +210,7 @@ if pioutil.is_pio_build():
#
# Return True if a matching feature is enabled
#
def MarlinFeatureIsEnabled(env, feature):
def MarlinHas(env, feature):
load_marlin_features()
r = re.compile('^' + feature + '$')
found = list(filter(r.match, env['MARLIN_FEATURES']))
@ -225,7 +223,7 @@ if pioutil.is_pio_build():
if val in [ '', '1', 'true' ]:
some_on = True
elif val in env['MARLIN_FEATURES']:
some_on = env.MarlinFeatureIsEnabled(val)
some_on = env.MarlinHas(val)
return some_on
@ -239,7 +237,7 @@ if pioutil.is_pio_build():
#
# Add a method for other PIO scripts to query enabled features
#
env.AddMethod(MarlinFeatureIsEnabled)
env.AddMethod(MarlinHas)
#
# Add dependencies for enabled Marlin features

View File

@ -10,7 +10,7 @@ if pioutil.is_pio_build():
Import("env")
if env.MarlinFeatureIsEnabled("POSTMORTEM_DEBUGGING"):
if env.MarlinHas("POSTMORTEM_DEBUGGING"):
FRAMEWORK_DIR = env.PioPlatform().get_package_dir("framework-arduinoststm32-maple")
patchflag_path = join(FRAMEWORK_DIR, ".exc-patching-done")

View File

@ -40,7 +40,10 @@ def run_preprocessor(env, fn=None):
depcmd = cmd + [ filename ]
cmd = ' '.join(depcmd)
blab(cmd)
define_list = subprocess.check_output(cmd, shell=True).splitlines()
try:
define_list = subprocess.check_output(cmd, shell=True).splitlines()
except:
define_list = {}
preprocessor_cache[filename] = define_list
return define_list