Skip to content

Commit

Permalink
🔨 PlatformIO 6 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jul 20, 2023
1 parent 5c225ba commit 8fd6f9a
Show file tree
Hide file tree
Showing 4 changed files with 228 additions and 233 deletions.
18 changes: 9 additions & 9 deletions buildroot/share/PlatformIO/scripts/common-dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def add_to_feat_cnf(feature, flines):
for line in atoms:
parts = line.split('=')
name = parts.pop(0)
if name in ['build_flags', 'extra_scripts', 'src_filter', 'lib_ignore']:
if name in ['build_flags', 'extra_scripts', 'build_src_filter', 'lib_ignore']:
feat[name] = '='.join(parts)
blab("[%s] %s=%s" % (feature, name, feat[name]), 3)
else:
Expand Down Expand Up @@ -173,19 +173,19 @@ def apply_features_config():
blab("Running extra_scripts for %s... " % feature, 2)
env.SConscript(feat['extra_scripts'], exports="env")

if 'src_filter' in feat:
if 'build_src_filter' in feat:
blab("========== Adding build_src_filter for %s... " % feature, 2)
src_filter = ' '.join(env.GetProjectOption('src_filter'))
build_src_filter = ' '.join(env.GetProjectOption('build_src_filter'))
# first we need to remove the references to the same folder
my_srcs = re.findall(r'[+-](<.*?>)', feat['src_filter'])
cur_srcs = re.findall(r'[+-](<.*?>)', src_filter)
my_srcs = re.findall(r'[+-](<.*?>)', feat['build_src_filter'])
cur_srcs = re.findall(r'[+-](<.*?>)', build_src_filter)
for d in my_srcs:
if d in cur_srcs:
src_filter = re.sub(r'[+-]' + d, '', src_filter)
build_src_filter = re.sub(r'[+-]' + d, '', build_src_filter)

src_filter = feat['src_filter'] + ' ' + src_filter
set_env_field('build_src_filter', [src_filter])
env.Replace(SRC_FILTER=src_filter)
build_src_filter = feat['build_src_filter'] + ' ' + build_src_filter
set_env_field('build_src_filter', [build_src_filter])
env.Replace(SRC_FILTER=build_src_filter)

if 'lib_ignore' in feat:
blab("========== Adding lib_ignore for %s... " % feature, 2)
Expand Down
3 changes: 2 additions & 1 deletion buildroot/share/PlatformIO/scripts/marlin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def copytree(src, dst, symlinks=False, ignore=None):
shutil.copy2(s, d)

def replace_define(field, value):
for define in env['CPPDEFINES']:
envdefs = env['CPPDEFINES'].copy()
for define in envdefs:
if define[0] == field:
env['CPPDEFINES'].remove(define)
env['CPPDEFINES'].append((field, value))
Expand Down
Loading

0 comments on commit 8fd6f9a

Please sign in to comment.