From a54154e760c0e3012b7841b317b277353174354d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 22 Jan 2021 20:51:58 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20Replace=20lib=5Fdeps=20for=20cus?= =?UTF-8?q?tom=5Fmarlin.FEATURE=20(#20858)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PlatformIO/scripts/common-dependencies.py | 23 ++++++++++++------- platformio.ini | 2 +- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies.py b/buildroot/share/PlatformIO/scripts/common-dependencies.py index 2f4ad3e502..4b8c339d46 100644 --- a/buildroot/share/PlatformIO/scripts/common-dependencies.py +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.py @@ -69,16 +69,23 @@ def add_to_feat_cnf(feature, flines): except: FEATURE_CONFIG[feature] = {} + # Get a reference to the FEATURE_CONFIG under construction feat = FEATURE_CONFIG[feature] - atoms = re.sub(',\\s*', '\n', flines).strip().split('\n') - for dep in atoms: - parts = dep.split('=') + + # Split up passed lines on commas or newlines and iterate + # Add common options to the features config under construction + # For lib_deps replace a previous instance of the same library + atoms = re.sub(r',\\s*', '\n', flines).strip().split('\n') + for line in atoms: + parts = line.split('=') name = parts.pop(0) - rest = '='.join(parts) if name in ['build_flags', 'extra_scripts', 'src_filter', 'lib_ignore']: - feat[name] = rest + feat[name] = '='.join(parts) else: - feat['lib_deps'] += [dep] + for dep in line.split(','): + lib_name = re.sub(r'([@~^=]|[<>]=?)[\d.]+', '', dep.strip()).split('=').pop(0) + lib_re = re.compile('(?!^' + lib_name + '\\b)') + feat['lib_deps'] = list(filter(lib_re.match, feat['lib_deps'])) + [dep] def load_config(): config = configparser.ConfigParser() @@ -185,8 +192,8 @@ def apply_features_config(): 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']) - cur_srcs = re.findall( r'[+-](<.*?>)', src_filter) + my_srcs = re.findall(r'[+-](<.*?>)', feat['src_filter']) + cur_srcs = re.findall(r'[+-](<.*?>)', src_filter) for d in my_srcs: if d in cur_srcs: src_filter = re.sub(r'[+-]' + d, '', src_filter) diff --git a/platformio.ini b/platformio.ini index 6b1543fa53..822f1df8d1 100644 --- a/platformio.ini +++ b/platformio.ini @@ -404,7 +404,7 @@ BEZIER_CURVE_SUPPORT = src_filter=+ + HAS_BED_PROBE = src_filter=+ + + + IS_SCARA = src_filter=+ -HAS_SERVOS = src_filter=+ + +HAS_SERVOS = src_filter=+ + MORGAN_SCARA = src_filter=+ HAS_MICROSTEPS = src_filter=+ (ESP3D_)?WIFISUPPORT = AsyncTCP, ESP Async WebServer