Skip to content

Commit 8dea671

Browse files
committed
Remove cleaning functionality from project_api.
It was possible to remove an entire project if clean was specified on the command line. That's a Bad Thing(tm).
1 parent e9d0fbd commit 8dea671

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

tools/project.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def setup_project(ide, target, program=None, source_dir=None, build=None):
6363

6464

6565
def export(target, ide, build=None, src=None, macros=None, project_id=None,
66-
clean=False, zip_proj=False, options=None):
66+
zip_proj=False, options=None):
6767
"""Do an export of a project.
6868
6969
Positional arguments:
@@ -75,16 +75,15 @@ def export(target, ide, build=None, src=None, macros=None, project_id=None,
7575
src - directory or directories that contain the source to export
7676
macros - extra macros to add to the project
7777
project_id - the name of the project
78-
clean - start from a clean state before exporting
7978
zip_proj - create a zip file or not
8079
"""
8180
project_dir, name, src, lib = setup_project(ide, target, program=project_id,
8281
source_dir=src, build=build)
8382

8483
zip_name = name+".zip" if zip_proj else None
8584

86-
export_project(src, project_dir, target, ide, clean=clean, name=name,
87-
macros=macros, libraries_paths=lib, zip_proj=zip_name, options=options)
85+
export_project(src, project_dir, target, ide, name=name, macros=macros,
86+
libraries_paths=lib, zip_proj=zip_name, options=options)
8887

8988

9089
def main():
@@ -219,8 +218,8 @@ def main():
219218
# Export to selected toolchain
220219
export(options.mcu, options.ide, build=options.build,
221220
src=options.source_dir, macros=options.macros,
222-
project_id=options.program, clean=options.clean,
223-
zip_proj=zip_proj, options=options.opts)
221+
project_id=options.program, zip_proj=zip_proj,
222+
options=options.opts)
224223

225224

226225
if __name__ == "__main__":

tools/project_api.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ def zip_export(file_name, prefix, resources, project_files):
130130

131131
def export_project(src_paths, export_path, target, ide,
132132
libraries_paths=None, options=None, linker_script=None,
133-
clean=False, notify=None, verbose=False, name=None,
134-
inc_dirs=None, jobs=1, silent=False, extra_verbose=False,
135-
config=None, macros=None, zip_proj=None):
133+
notify=None, verbose=False, name=None, inc_dirs=None,
134+
jobs=1, silent=False, extra_verbose=False, config=None,
135+
macros=None, zip_proj=None):
136136
"""Generates a project file and creates a zip archive if specified
137137
138138
Positional Arguments:
@@ -145,7 +145,6 @@ def export_project(src_paths, export_path, target, ide,
145145
libraries_paths - paths to additional libraries
146146
options - build options passed by -o flag
147147
linker_script - path to the linker script for the specified target
148-
clean - removes the export_path if it exists
149148
notify - function is passed all events, and expected to handle notification
150149
of the user, emit the events to a log, etc.
151150
verbose - assigns the notify function to toolchains print_notify_verbose
@@ -177,19 +176,16 @@ def export_project(src_paths, export_path, target, ide,
177176
src_paths = {"": paths}
178177

179178
# Export Directory
180-
if exists(export_path) and clean:
181-
rmtree(export_path)
182179
if not exists(export_path):
183180
makedirs(export_path)
184181

185182
_, toolchain_name = get_exporter_toolchain(ide)
186183

187184
# Pass all params to the unified prepare_resources()
188185
toolchain = prepare_toolchain(paths, target, toolchain_name,
189-
macros=macros, options=options, clean=clean,
190-
jobs=jobs, notify=notify, silent=silent,
191-
verbose=verbose, extra_verbose=extra_verbose,
192-
config=config)
186+
macros=macros, options=options, jobs=jobs,
187+
notify=notify, silent=silent, verbose=verbose,
188+
extra_verbose=extra_verbose, config=config)
193189
# The first path will give the name to the library
194190
if name is None:
195191
name = basename(normpath(abspath(src_paths[0])))

0 commit comments

Comments
 (0)