Skip to content

Commit ed7793d

Browse files
committed
Add clean methods to many more exporters
1 parent bd5b34f commit ed7793d

File tree

11 files changed

+62
-2
lines changed

11 files changed

+62
-2
lines changed

tools/export/atmelstudio/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""
1717
import uuid
1818
from os.path import splitext, basename, dirname
19+
from os import remove
1920

2021
from tools.export.exporters import Exporter, deprecated_exporter
2122

@@ -83,3 +84,8 @@ def generate(self):
8384
target = self.target.lower()
8485
self.gen_file('atmelstudio/atsln.tmpl', ctx, '%s.atsln' % self.project_name)
8586
self.gen_file('atmelstudio/cppproj.tmpl', ctx, '%s.cppproj' % self.project_name)
87+
88+
@staticmethod
89+
def clean(project_name):
90+
remove('%s.atsln' % project_name)
91+
remove('%s.cppproj' % project_name)

tools/export/cdt/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import re
22

33
from os.path import join, exists
4-
from os import makedirs
4+
from os import makedirs, remove
5+
import shutil
56

67
from tools.export.makefile import Makefile, GccArm, Armc5, IAR
78

@@ -39,6 +40,12 @@ def generate(self):
3940
self.gen_file('cdt/.cproject.tmpl', ctx, '.cproject')
4041
self.gen_file('cdt/.project.tmpl', ctx, '.project')
4142

43+
@staticmethod
44+
def clean(project_name):
45+
shutil.rmtree("eclipse-extras")
46+
remove(".cproject")
47+
remove(".project")
48+
4249

4350
class EclipseGcc(Eclipse, GccArm):
4451
LOAD_EXE = True

tools/export/cmsis/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,8 @@ def generate(self):
153153
'date': ''
154154
}
155155
self.gen_file('cmsis/cpdsc.tmpl', ctx, 'project.cpdsc')
156+
157+
158+
@staticmethod
159+
def clean(_):
160+
os.remove('project.cpdsc')

tools/export/coide/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
limitations under the License.
1616
"""
1717
from os.path import splitext, basename
18+
from os import remove
1819

1920
from tools.export.exporters import Exporter, deprecated_exporter
2021

@@ -109,3 +110,7 @@ def generate(self):
109110

110111
# Project file
111112
self.gen_file('coide/%s.coproj.tmpl' % target, ctx, '%s.coproj' % self.project_name)
113+
114+
@staticmethod
115+
def clean(project_name):
116+
remove('%s.coproj' % project_name)

tools/export/e2studio/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
1616
"""
17+
from os import remove
1718
from tools.export.gnuarmeclipse import GNUARMEclipse
1819

1920
class E2Studio(GNUARMEclipse):
@@ -39,3 +40,8 @@ def generate(self):
3940
self.gen_file('gnuarmeclipse/.project.tmpl', jinja_ctx, '.project', trim_blocks=True, lstrip_blocks=True)
4041
self.gen_file_nonoverwrite('gnuarmeclipse/mbedignore.tmpl', jinja_ctx, '.mbedignore')
4142
self.gen_file('gnuarmeclipse/makefile.targets.tmpl', jinja_ctx, 'makefile.targets', trim_blocks=True, lstrip_blocks=True)
43+
44+
@staticmethod
45+
def clean(project_name):
46+
remove('%s OpenOCD 5x.launch' % project_name)
47+
remove('%s OpenOCD.launch' % project_name)

tools/export/embitz/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
limitations under the License.
1616
"""
1717
from os.path import splitext, basename
18+
from os import remove
1819
from tools.targets import TARGET_MAP
1920
from tools.export.exporters import Exporter, apply_supported_whitelist
2021

@@ -87,3 +88,7 @@ def generate(self):
8788
}
8889

8990
self.gen_file('embitz/eix.tmpl', ctx, '%s.eix' % self.project_name)
91+
92+
@staticmethod
93+
def clean(project_name):
94+
remove("%s.eix" % project_name)

tools/export/kds/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
limitations under the License.
1616
"""
1717
from os.path import splitext, basename
18+
from os import remove
1819

1920
from tools.export.exporters import Exporter, deprecated_exporter
2021

@@ -47,3 +48,7 @@ def generate(self):
4748
self.gen_file('kds/%s_project.tmpl' % self.target.lower(), ctx, '.project')
4849
self.gen_file('kds/%s_cproject.tmpl' % self.target.lower(), ctx, '.cproject')
4950
self.gen_file('kds/launch.tmpl', ctx, '%s.launch' % self.project_name)
51+
52+
@staticmethod
53+
def clean(project_name):
54+
remove('%s.launch' % project_name)

tools/export/qtcreator/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
limitations under the License.
1616
"""
1717
from os.path import splitext, basename
18+
from os import remove
1819
from tools.targets import TARGET_MAP
1920
from tools.export.exporters import Exporter
2021
from tools.export.makefile import GccArm
@@ -63,3 +64,8 @@ def generate(self):
6364

6465
# finally, generate the Makefile
6566
super(QtCreator, self).generate()
67+
68+
@staticmethod
69+
def clean(project_name):
70+
for ext in ['creator', 'files', 'includes', 'config']:
71+
remove("%s.%s" % (project_name, ext))

tools/export/simplicity/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
limitations under the License.
1616
"""
1717
from os.path import split,splitext, basename
18+
from os import remove
1819

1920
from tools.export.exporters import Exporter, deprecated_exporter
2021

@@ -194,3 +195,7 @@ def generate(self):
194195
'''
195196

196197
self.gen_file('simplicity/slsproj.tmpl', ctx, '%s.slsproj' % self.project_name)
198+
199+
@staticmethod
200+
def clean(project_name):
201+
remove('%s.slsproj' % project_name)

tools/export/sw4stm32/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""
1717

1818
from os.path import splitext, basename, join
19+
import shutil
1920
from tools.utils import mkdir
2021
from tools.export.gnuarmeclipse import GNUARMEclipse
2122
from tools.export.gnuarmeclipse import UID
@@ -557,3 +558,7 @@ def generate(self):
557558
'makefile.targets', trim_blocks=True, lstrip_blocks=True)
558559
self.gen_file('sw4stm32/launch.tmpl', ctx, self.project_name +
559560
' ' + options['debug']['name'] + '.launch')
561+
562+
@staticmethod
563+
def clean(_):
564+
shutil.rmtree(".settings")

0 commit comments

Comments
 (0)