mirror of https://github.com/ARMmbed/mbed-os.git
[PROJECT.py] add option 'clean'
Adds the cmdline option clean (to clean the export folder) and some minor things (spelling and option order).pull/563/head
parent
bac84a58bd
commit
0791533ef2
|
@ -3,7 +3,8 @@ from os.path import join, abspath, dirname, exists
|
||||||
ROOT = abspath(join(dirname(__file__), ".."))
|
ROOT = abspath(join(dirname(__file__), ".."))
|
||||||
sys.path.insert(0, ROOT)
|
sys.path.insert(0, ROOT)
|
||||||
|
|
||||||
from shutil import move
|
from shutil import move, rmtree
|
||||||
|
from os.path import join, exists, basename
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
from workspace_tools.paths import EXPORT_DIR, EXPORT_WORKSPACE, EXPORT_TMP
|
from workspace_tools.paths import EXPORT_DIR, EXPORT_WORKSPACE, EXPORT_TMP
|
||||||
|
@ -30,20 +31,23 @@ if __name__ == '__main__':
|
||||||
parser.add_option("-m", "--mcu", metavar="MCU", default='LPC1768',
|
parser.add_option("-m", "--mcu", metavar="MCU", default='LPC1768',
|
||||||
help="generate project for the given MCU (%s)" % ', '.join(targetnames))
|
help="generate project for the given MCU (%s)" % ', '.join(targetnames))
|
||||||
|
|
||||||
|
parser.add_option("-i", dest="ide", default='uvision',
|
||||||
|
help="The target IDE: %s" % str(toolchainlist))
|
||||||
|
|
||||||
|
parser.add_option("-c", "--clean", action="store_true", default=False,
|
||||||
|
help="clean the export directory")
|
||||||
|
|
||||||
parser.add_option("-p", type="int", dest="program",
|
parser.add_option("-p", type="int", dest="program",
|
||||||
help="The index of the desired test program: [0-%d]" % (len(TESTS)-1))
|
help="The index of the desired test program: [0-%d]" % (len(TESTS)-1))
|
||||||
|
|
||||||
parser.add_option("-n", dest="program_name",
|
parser.add_option("-n", dest="program_name",
|
||||||
help="The name of the desired test program")
|
help="The name of the desired test program")
|
||||||
|
|
||||||
parser.add_option("-i", dest="ide", default='uvision',
|
|
||||||
help="The target IDE: %s" % str(toolchainlist))
|
|
||||||
|
|
||||||
parser.add_option("-b", dest="build", action="store_true", default=False,
|
parser.add_option("-b", dest="build", action="store_true", default=False,
|
||||||
help="Use the mbed library build, instead of the sources")
|
help="use the mbed library build, instead of the sources")
|
||||||
|
|
||||||
parser.add_option("-L", "--list-tests", action="store_true", dest="list_tests", default=False,
|
parser.add_option("-L", "--list-tests", action="store_true", dest="list_tests", default=False,
|
||||||
help="List available tests in order and exit")
|
help="list available programs in order and exit")
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
@ -52,6 +56,13 @@ if __name__ == '__main__':
|
||||||
if options.list_tests is True:
|
if options.list_tests is True:
|
||||||
print '\n'.join(map(str, sorted(TEST_MAP.values())))
|
print '\n'.join(map(str, sorted(TEST_MAP.values())))
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
# Clean Export Directory
|
||||||
|
if options.clean:
|
||||||
|
if exists(EXPORT_DIR):
|
||||||
|
rmtree(EXPORT_DIR)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
# Target
|
# Target
|
||||||
if options.mcu is None :
|
if options.mcu is None :
|
||||||
|
@ -99,7 +110,7 @@ if __name__ == '__main__':
|
||||||
test.dependencies.remove(MBED_LIBRARIES)
|
test.dependencies.remove(MBED_LIBRARIES)
|
||||||
test.dependencies.append(MBED_BASE)
|
test.dependencies.append(MBED_BASE)
|
||||||
|
|
||||||
# Build the projectwith the same directory structure of the mbed online IDE
|
# Build the project with the same directory structure of the mbed online IDE
|
||||||
project_dir = join(EXPORT_WORKSPACE, test.id)
|
project_dir = join(EXPORT_WORKSPACE, test.id)
|
||||||
setup_user_prj(project_dir, test.source_dir, test.dependencies)
|
setup_user_prj(project_dir, test.source_dir, test.dependencies)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue