diff --git a/buildroot/share/PlatformIO/scripts/marlin.py b/buildroot/share/PlatformIO/scripts/marlin.py index 169dd9d3c3..8d8dbb5b63 100644 --- a/buildroot/share/PlatformIO/scripts/marlin.py +++ b/buildroot/share/PlatformIO/scripts/marlin.py @@ -16,7 +16,8 @@ def copytree(src, dst, symlinks=False, ignore=None): shutil.copy2(item, dst / item.name) 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))