From b668185339b9fc1f7f1c0bb09d85d8503eec6dc6 Mon Sep 17 00:00:00 2001 From: Franz Schnyder Date: Thu, 5 Jan 2017 14:20:54 +0100 Subject: [PATCH 1/2] Correctly format include paths for eclipse export Eclipse CDT expects the include paths to include the project name like '//' for workspace include directories. See issue #3529. --- tools/export/cdt/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/export/cdt/__init__.py b/tools/export/cdt/__init__.py index 05147d07fc..220b74800b 100644 --- a/tools/export/cdt/__init__.py +++ b/tools/export/cdt/__init__.py @@ -1,3 +1,5 @@ +import re + from os.path import join, exists, realpath, relpath, basename from os import makedirs @@ -12,13 +14,14 @@ class Eclipse(Makefile): py_ocd_settings launch file, and software link .p2f file """ super(Eclipse, self).generate() + include_paths_replace_re= re.compile(r'(^[.]/|^[.]$)') ctx = { 'name': self.project_name, 'elf_location': join('BUILD',self.project_name)+'.elf', 'c_symbols': self.toolchain.get_symbols(), 'asm_symbols': self.toolchain.get_symbols(True), 'target': self.target, - 'include_paths': self.resources.inc_dirs, + 'include_paths': map(lambda s: include_paths_replace_re.sub('%s/' % self.project_name, s), self.resources.inc_dirs), 'load_exe': str(self.LOAD_EXE).lower() } From 75a61dfe788102d04e1cc3b151e839fa9add724f Mon Sep 17 00:00:00 2001 From: Franz Schnyder Date: Thu, 5 Jan 2017 18:17:46 +0100 Subject: [PATCH 2/2] Fix review requests - Shorten variable name - Use comprehension to format include paths --- tools/export/cdt/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/export/cdt/__init__.py b/tools/export/cdt/__init__.py index 220b74800b..ff978b6fc7 100644 --- a/tools/export/cdt/__init__.py +++ b/tools/export/cdt/__init__.py @@ -14,14 +14,14 @@ class Eclipse(Makefile): py_ocd_settings launch file, and software link .p2f file """ super(Eclipse, self).generate() - include_paths_replace_re= re.compile(r'(^[.]/|^[.]$)') + starting_dot = re.compile(r'(^[.]/|^[.]$)') ctx = { 'name': self.project_name, 'elf_location': join('BUILD',self.project_name)+'.elf', 'c_symbols': self.toolchain.get_symbols(), 'asm_symbols': self.toolchain.get_symbols(True), 'target': self.target, - 'include_paths': map(lambda s: include_paths_replace_re.sub('%s/' % self.project_name, s), self.resources.inc_dirs), + 'include_paths': [starting_dot.sub('%s/' % self.project_name, inc) for inc in self.resources.inc_dirs], 'load_exe': str(self.LOAD_EXE).lower() }