Skip to content

Commit

Permalink
Partially revert "Custom build_flags by feature (MarlinFirmware#20692)"
Browse files Browse the repository at this point in the history
blab(f'str') requires Python 3.6... adapt for both...
  • Loading branch information
tpruvot committed Jan 8, 2021
1 parent 4eedeab commit 051e834
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions buildroot/share/PlatformIO/scripts/common-dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ def force_ignore_unused_libs():
known_libs = get_all_known_libs()
diff = (list(set(known_libs) - set(env_libs)))
lib_ignore = env.GetProjectOption('lib_ignore') + diff
blab(f'Ignore libraries: {lib_ignore}')
if verbose:
print("Ignore libraries:", lib_ignore)
set_env_field('lib_ignore', lib_ignore)

def apply_features_config():
Expand All @@ -144,7 +145,7 @@ def apply_features_config():
feat = FEATURE_CONFIG[feature]

if 'lib_deps' in feat and len(feat['lib_deps']):
blab(f'Adding lib_deps for {feature}...')
blab("Adding lib_deps for %s... " % feature)

# feat to add
deps_to_add = {}
Expand Down Expand Up @@ -173,16 +174,16 @@ def apply_features_config():

if 'build_flags' in feat:
f = feat['build_flags']
blab(f'Adding build_flags for {feature}: {f}')
blab("Adding build_flags for %s: %s" % (feature, f))
new_flags = env.GetProjectOption('build_flags') + [ f ]
env.Replace(BUILD_FLAGS=new_flags)

if 'extra_scripts' in feat:
blab(f'Running extra_scripts for {feature}...')
blab("Running extra_scripts for %s... " % feature)
env.SConscript(feat['extra_scripts'], exports="env")

if 'src_filter' in feat:
blab(f'Adding src_filter for {feature}...')
blab("Adding src_filter for %s... " % feature)
src_filter = ' '.join(env.GetProjectOption('src_filter'))
# first we need to remove the references to the same folder
my_srcs = re.findall( r'[+-](<.*?>)', feat['src_filter'])
Expand All @@ -196,7 +197,7 @@ def apply_features_config():
env.Replace(SRC_FILTER=src_filter)

if 'lib_ignore' in feat:
blab(f'Adding lib_ignore for {feature}...')
blab("Adding lib_ignore for %s... " % feature)
lib_ignore = env.GetProjectOption('lib_ignore') + [feat['lib_ignore']]
set_env_field('lib_ignore', lib_ignore)

Expand Down Expand Up @@ -248,7 +249,7 @@ def search_compiler():
return filepath

filepath = env.get('CXX')
blab(f"Couldn't find a compiler! Fallback to {filepath}")
blab("Couldn't find a compiler! Fallback to %s" % filepath)
return filepath

#
Expand Down

0 comments on commit 051e834

Please sign in to comment.