Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: project.py
- Revision:
- 35:da9c89f8be7d
- Parent:
- 31:8ea194f6145b
- Child:
- 36:96847d42f010
--- a/project.py Mon Feb 13 09:29:13 2017 -0600 +++ b/project.py Wed Feb 15 13:53:18 2017 -0600 @@ -11,6 +11,7 @@ from os.path import normpath, realpath from tools.paths import EXPORT_DIR, MBED_HAL, MBED_LIBRARIES, MBED_TARGETS_PATH +from tools.settings import BUILD_DIR from tools.export import EXPORTERS, mcu_ide_matrix from tools.tests import TESTS, TEST_MAP from tools.tests import test_known, test_name_known, Test @@ -66,8 +67,7 @@ def export(target, ide, build=None, src=None, macros=None, project_id=None, - clean=False, zip_proj=False, build_profile=None, export_path=None, - silent=False): + zip_proj=False, build_profile=None, export_path=None, silent=False): """Do an export of a project. Positional arguments: @@ -89,9 +89,9 @@ zip_name = name+".zip" if zip_proj else None - return export_project(src, project_dir, target, ide, clean=clean, name=name, - macros=macros, libraries_paths=lib, zip_proj=zip_name, - build_profile=build_profile, silent=silent) + return export_project(src, project_dir, target, ide, name=name, + macros=macros, libraries_paths=lib, zip_proj=zip_name, + build_profile=build_profile, silent=silent) def main(): @@ -106,14 +106,12 @@ parser.add_argument("-m", "--mcu", metavar="MCU", - default='LPC1768', type=argparse_force_uppercase_type(targetnames, "MCU"), help="generate project for the given MCU ({})".format( ', '.join(targetnames))) parser.add_argument("-i", dest="ide", - default='uvision', type=argparse_force_lowercase_type( toolchainlist, "toolchain"), help="The target IDE: %s"% str(toolchainlist)) @@ -215,14 +213,6 @@ cache = Cache(True, True) cache.cache_descriptors() - # Clean Export Directory - if options.clean: - if exists(EXPORT_DIR): - rmtree(EXPORT_DIR) - - for mcu in options.mcu: - zip_proj = not bool(options.source_dir) - # Target if not options.mcu: args_error(parser, "argument -m/--mcu is required") @@ -231,17 +221,27 @@ if not options.ide: args_error(parser, "argument -i is required") + # Clean Export Directory + if options.clean: + if exists(EXPORT_DIR): + rmtree(EXPORT_DIR) + + for mcu in options.mcu: + zip_proj = not bool(options.source_dir) + if (options.program is None) and (not options.source_dir): args_error(parser, "one of -p, -n, or --source is required") # Export to selected toolchain exporter, toolchain_name = get_exporter_toolchain(options.ide) if options.mcu not in exporter.TARGETS: args_error(parser, "%s not supported by %s"%(options.mcu,options.ide)) - profile = extract_profile(parser, options, toolchain_name) + profile = extract_profile(parser, options, toolchain_name, fallback="debug") + if options.clean: + rmtree(BUILD_DIR) export(options.mcu, options.ide, build=options.build, src=options.source_dir, macros=options.macros, - project_id=options.program, clean=options.clean, - zip_proj=zip_proj, build_profile=profile) + project_id=options.program, zip_proj=zip_proj, + build_profile=profile) if __name__ == "__main__":