Clone of official tools

Revision:
13:ab47a20b66f0
Parent:
0:66f3b5499f7f
Child:
22:9e85236d8716
diff -r f2e8a005c7d3 -r ab47a20b66f0 project.py
--- a/project.py	Tue Jun 14 11:33:06 2016 +0100
+++ b/project.py	Thu Jul 14 20:21:19 2016 +0100
@@ -79,6 +79,7 @@
                       help="writes tools/export/README.md")
 
     parser.add_option("--source",
+                      action="append",
                       dest="source_dir",
                       default=None,
                       help="The source (input) directory")
@@ -147,8 +148,8 @@
         if src is not None:
             # --source is used to generate IDE files to toolchain directly in the source tree and doesn't generate zip file
             project_dir = options.source_dir
-            project_name = basename(project_dir)
-            project_temp = path.join(options.source_dir, 'projectfiles', ide)
+            project_name = n if n else "Unnamed_Project"
+            project_temp = path.join(options.source_dir[0], 'projectfiles', '%s_%s' % (ide, mcu))
             mkdir(project_temp)
             lib_symbols = []
             if options.macros:
@@ -204,16 +205,17 @@
 
             # Build the project with the same directory structure of the mbed online IDE
             project_name = test.id
-            project_dir = join(EXPORT_WORKSPACE, project_name)
+            project_dir = [join(EXPORT_WORKSPACE, project_name)]
             project_temp = EXPORT_TMP
-            setup_user_prj(project_dir, test.source_dir, test.dependencies)
+            setup_user_prj(project_dir[0], test.source_dir, test.dependencies)
 
         # Export to selected toolchain
-        tmp_path, report = export(project_dir, project_name, ide, mcu, project_dir, project_temp, clean=clean, zip=zip, extra_symbols=lib_symbols, relative=sources_relative)
-        print tmp_path
+        tmp_path, report = export(project_dir, project_name, ide, mcu, project_dir[0], project_temp, clean=clean, make_zip=zip, extra_symbols=lib_symbols, sources_relative=sources_relative)
         if report['success']:
-            zip_path = join(EXPORT_DIR, "%s_%s_%s.zip" % (project_name, ide, mcu))
-            if zip:
+            if not zip:
+                zip_path = join(project_temp, project_name)
+            else:
+                zip_path = join(EXPORT_DIR, "%s_%s_%s.zip" % (project_name, ide, mcu))
                 move(tmp_path, zip_path)
             successes.append("%s::%s\t%s"% (mcu, ide, zip_path))
         else: