Clone of official tools

Revision:
36:96847d42f010
Parent:
35:da9c89f8be7d
Child:
40:7d3fa6b99b2b
diff -r da9c89f8be7d -r 96847d42f010 export/exporters.py
--- a/export/exporters.py	Wed Feb 15 13:53:18 2017 -0600
+++ b/export/exporters.py	Thu Jun 22 11:12:28 2017 -0500
@@ -60,7 +60,8 @@
         jinja_loader = FileSystemLoader(os.path.dirname(os.path.abspath(__file__)))
         self.jinja_environment = Environment(loader=jinja_loader)
         self.resources = resources
-        self.generated_files = [join(self.TEMPLATE_DIR,"GettingStarted.html")]
+        self.generated_files = [join(self.TEMPLATE_DIR, "GettingStarted.html"),
+                                join(self.TEMPLATE_DIR, ".mbed")]
         self.builder_files_dict = {}
         self.add_config()
 
@@ -176,3 +177,20 @@
     def generate(self):
         """Generate an IDE/tool specific project file"""
         raise NotImplemented("Implement a generate function in Exporter child class")
+
+
+def filter_supported(compiler, whitelist):
+    """Generate a list of supported targets for a given compiler and post-binary hook
+    white-list."""
+    def supported_p(obj):
+        """Internal inner function used for filtering"""
+        if compiler not in obj.supported_toolchains:
+            return False
+        if not hasattr(obj, "post_binary_hook"):
+            return True
+        if obj.post_binary_hook['function'] in whitelist:
+            return True
+        else:
+            return False
+    return list(target for target, obj in TARGET_MAP.iteritems()
+                if supported_p(obj))