Clone of official tools

Revision:
13:ab47a20b66f0
Parent:
0:66f3b5499f7f
Child:
23:fbae331171fa
diff -r f2e8a005c7d3 -r ab47a20b66f0 export/__init__.py
--- a/export/__init__.py	Tue Jun 14 11:33:06 2016 +0100
+++ b/export/__init__.py	Thu Jul 14 20:21:19 2016 +0100
@@ -20,7 +20,7 @@
 import yaml
 
 from tools.utils import mkdir
-from tools.export import uvision4, codered, gccarm, ds5_5, iar, emblocks, coide, kds, zip, simplicityv3, atmelstudio, sw4stm32
+from tools.export import uvision4, uvision5, codered, gccarm, ds5_5, iar, emblocks, coide, kds, zip, simplicityv3, atmelstudio, sw4stm32, e2studio
 from tools.export.exporters import zip_working_directory_and_clean_up, OldLibrariesException
 from tools.targets import TARGET_NAMES, EXPORT_MAP, TARGET_MAP
 
@@ -28,6 +28,8 @@
 
 EXPORTERS = {
     'uvision': uvision4.Uvision4,
+    'uvision4': uvision4.Uvision4,
+    'uvision5': uvision5.Uvision5,
     'lpcxpresso': codered.CodeRed,
     'gcc_arm': gccarm.GccArm,
     'ds5_5': ds5_5.DS5_5,
@@ -38,6 +40,7 @@
     'simplicityv3' : simplicityv3.SimplicityV3,
     'atmelstudio' : atmelstudio.AtmelStudio,
     'sw4stm32'    : sw4stm32.Sw4STM32,
+    'e2studio' : e2studio.E2Studio,
 }
 
 ERROR_MESSAGE_UNSUPPORTED_TOOLCHAIN = """
@@ -55,7 +58,7 @@
 
 
 def export(project_path, project_name, ide, target, destination='/tmp/',
-           tempdir=None, clean=True, extra_symbols=None, zip=True, build_url_resolver=online_build_url_resolver, relative=False):
+           tempdir=None, clean=True, extra_symbols=None, make_zip=True, sources_relative=False, build_url_resolver=online_build_url_resolver):
     # Convention: we are using capitals for toolchain and target names
     if target is not None:
         target = target.upper()
@@ -63,13 +66,16 @@
     if tempdir is None:
         tempdir = tempfile.mkdtemp()
 
+    use_progen = False
+    supported = True
     report = {'success': False, 'errormsg':''}
+    
     if ide is None or ide == "zip":
         # Simple ZIP exporter
         try:
             ide = "zip"
             exporter = zip.ZIP(target, tempdir, project_name, build_url_resolver, extra_symbols=extra_symbols)
-            exporter.scan_and_copy_resources(project_path, tempdir)
+            exporter.scan_and_copy_resources(project_path, tempdir, sources_relative)
             exporter.generate()
             report['success'] = True
         except OldLibrariesException, e:
@@ -80,9 +86,6 @@
         else:
             Exporter = EXPORTERS[ide]
             target = EXPORT_MAP.get(target, target)
-            # use progen targets or mbed exporters targets, check progen attribute
-            use_progen = False
-            supported = True
             try:
                 if Exporter.PROGEN_ACTIVE:
                     use_progen = True
@@ -98,8 +101,8 @@
             if supported:
                 # target checked, export
                 try:
-                    exporter = Exporter(target, tempdir, project_name, build_url_resolver, extra_symbols=extra_symbols)
-                    exporter.scan_and_copy_resources(project_path, tempdir, relative)
+                    exporter = Exporter(target, tempdir, project_name, build_url_resolver, extra_symbols=extra_symbols, sources_relative=sources_relative)
+                    exporter.scan_and_copy_resources(project_path, tempdir, sources_relative)
                     exporter.generate()
                     report['success'] = True
                 except OldLibrariesException, e:
@@ -132,9 +135,8 @@
         open(os.path.join(tempdir, 'GettingStarted.htm'),'w').write('<meta http-equiv="refresh" content="0; url=http://mbed.org/handbook/Getting-Started-mbed-Exporters#%s"/>'% (ide))
         # copy .hgignore file to exported direcotry as well.
         if exists(os.path.join(exporter.TEMPLATE_DIR,'.hgignore')):
-            copy(os.path.join(exporter.TEMPLATE_DIR,'.hgignore'),tempdir)
-
-        if zip:
+            copy(os.path.join(exporter.TEMPLATE_DIR,'.hgignore'), tempdir)
+        if make_zip:
             zip_path = zip_working_directory_and_clean_up(tempdir, destination, project_name, clean)
         else:
             zip_path = destination