diff --git a/tools/export/exporters.py b/tools/export/exporters.py index b9dc8c7591d..8524334a60b 100644 --- a/tools/export/exporters.py +++ b/tools/export/exporters.py @@ -259,6 +259,20 @@ def is_target_supported(cls, target_name): def all_supported_targets(cls): return [t for t in TARGET_MAP.keys() if cls.is_target_supported(t)] + @staticmethod + def filter_dot(str): + """ + Remove the './' or '.\\' prefix, if present. + """ + if str == None: + return None + if str[:2] == './': + return str[2:] + if str[:2] == '.\\': + return str[2:] + return str + + def apply_supported_whitelist(compiler, whitelist, target): """Generate a list of supported targets for a given compiler and post-binary hook diff --git a/tools/export/gnuarmeclipse/__init__.py b/tools/export/gnuarmeclipse/__init__.py index a1f8d7cddc2..f288eeba510 100644 --- a/tools/export/gnuarmeclipse/__init__.py +++ b/tools/export/gnuarmeclipse/__init__.py @@ -417,21 +417,6 @@ def compute_exclusions(self): # ------------------------------------------------------------------------- - @staticmethod - def filter_dot(str): - """ - Remove the './' prefix, if present. - This function assumes that resources.win_to_unix() - replaced all windows backslashes with slashes. - """ - if str == None: - return None - if str[:2] == './': - return str[2:] - return str - - # ------------------------------------------------------------------------- - def dump_tree(self, nodes, depth=0): for k in nodes.keys(): node = nodes[k] diff --git a/tools/export/uvision/__init__.py b/tools/export/uvision/__init__.py index 38ff88dfb6a..e75a8e07a8c 100644 --- a/tools/export/uvision/__init__.py +++ b/tools/export/uvision/__init__.py @@ -178,7 +178,7 @@ def format_flags(self): template = ["--no_vla", "--cpp", "--c99"] # Flag is invalid if set in template # Optimizations are also set in the template - invalid_flag = lambda x: x in template or re.match("-O(\d|time)", x) + invalid_flag = lambda x: x in template or re.match("-O(\d|time)", x) flags['c_flags'] = [flag.replace('"','\\"') for flag in c_flags if not invalid_flag(flag)] flags['c_flags'] = " ".join(flags['c_flags']) flags['ld_flags'] = " ".join(flags['ld_flags']) @@ -215,7 +215,8 @@ def generate(self): # UVFile tuples defined above 'project_files': sorted(list(self.format_src(srcs).items()), key=lambda tuple: tuple[0].lower()), - 'include_paths': '; '.join(self.resources.inc_dirs).encode('utf-8'), + 'include_paths': ';'.join(self.filter_dot(d) for d in + self.resources.inc_dirs).encode('utf-8'), 'device': DeviceUvision(self.target), } sct_file = self.resources.linker_script