Skip to content

Commit

Permalink
Fix Python 2.7 compatibility
Browse files Browse the repository at this point in the history
Fix regression from MarlinFirmware#20692
  • Loading branch information
thinkyhead authored and kpishere committed Feb 19, 2021
1 parent 75e5d3c commit c46629f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions buildroot/share/PlatformIO/scripts/common-dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ 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}')
blab("Ignore libraries: %s" % lib_ignore)
set_env_field('lib_ignore', lib_ignore)

def apply_features_config():
Expand All @@ -144,7 +144,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 +173,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 +196,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 All @@ -208,13 +208,13 @@ def apply_features_config():
def search_compiler():
try:
filepath = env.GetProjectOption('custom_gcc')
blab('Getting compiler from env')
blab("Getting compiler from env")
return filepath
except:
pass

if os.path.exists(GCC_PATH_CACHE):
blab('Getting g++ path from cache')
blab("Getting g++ path from cache")
with open(GCC_PATH_CACHE, 'r') as f:
return f.read()

Expand All @@ -241,14 +241,14 @@ def search_compiler():
filepath = os.path.sep.join([pathdir, filepath])
# Cache the g++ path to no search always
if os.path.exists(ENV_BUILD_PATH):
blab('Caching g++ for current env')
blab("Caching g++ for current env")
with open(GCC_PATH_CACHE, 'w+') as f:
f.write(filepath)

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 c46629f

Please sign in to comment.