From b0f5b3d768d5a7650bb7c52eb1d2e4cc172ca870 Mon Sep 17 00:00:00 2001 From: Johan Stokking Date: Mon, 24 Jul 2017 20:39:28 +0200 Subject: [PATCH 1/4] Copy static files only Signed-off-by: Johan Stokking --- tools/export/__init__.py | 6 +++--- tools/export/exporters.py | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/export/__init__.py b/tools/export/__init__.py index d63318503a..52f22d4d22 100644 --- a/tools/export/__init__.py +++ b/tools/export/__init__.py @@ -351,8 +351,8 @@ def export_project(src_paths, export_path, target, ide, libraries_paths=None, else: zip_export(zip_proj, name, resource_dict, files, inc_repos) else: - for exported in files: - if not exists(join(export_path, basename(exported))): - copyfile(exported, join(export_path, basename(exported))) + for static_file in exporter.static_files: + if not exists(join(export_path, basename(static_file))): + copyfile(static_file, join(export_path, basename(static_file))) return exporter diff --git a/tools/export/exporters.py b/tools/export/exporters.py index 2598ce150a..dad773de5d 100644 --- a/tools/export/exporters.py +++ b/tools/export/exporters.py @@ -60,8 +60,9 @@ class Exporter(object): 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"), - join(self.TEMPLATE_DIR, ".mbed")] + self.generated_files = [] + self.static_files = [join(self.TEMPLATE_DIR, "GettingStarted.html"), + join(self.TEMPLATE_DIR, ".mbed")] self.builder_files_dict = {} self.add_config() From f8abcf4050c90d6c9b7c2a511bd868f775b1a3af Mon Sep 17 00:00:00 2001 From: Johan Stokking Date: Mon, 24 Jul 2017 21:11:09 +0200 Subject: [PATCH 2/4] Copy static files also when zipping --- tools/export/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/export/__init__.py b/tools/export/__init__.py index 52f22d4d22..0e4acb6461 100644 --- a/tools/export/__init__.py +++ b/tools/export/__init__.py @@ -350,9 +350,9 @@ def export_project(src_paths, export_path, target, ide, libraries_paths=None, inc_repos) else: zip_export(zip_proj, name, resource_dict, files, inc_repos) - else: - for static_file in exporter.static_files: - if not exists(join(export_path, basename(static_file))): - copyfile(static_file, join(export_path, basename(static_file))) + + for static_file in exporter.static_files: + if not exists(join(export_path, basename(static_file))): + copyfile(static_file, join(export_path, basename(static_file))) return exporter From 9bcd1da2fa32af6becbaefaad4f9c7a6d4642fb0 Mon Sep 17 00:00:00 2001 From: Johan Stokking Date: Tue, 25 Jul 2017 13:46:55 +0200 Subject: [PATCH 3/4] ZIP export static files Signed-off-by: Johan Stokking --- tools/export/__init__.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/export/__init__.py b/tools/export/__init__.py index 0e4acb6461..3bcbb3a727 100644 --- a/tools/export/__init__.py +++ b/tools/export/__init__.py @@ -346,13 +346,14 @@ def export_project(src_paths, export_path, target, ide, libraries_paths=None, if label not in toolchain.target.features: resource.add(res) if isinstance(zip_proj, basestring): - zip_export(join(export_path, zip_proj), name, resource_dict, files, - inc_repos) + zip_export(join(export_path, zip_proj), name, resource_dict, + files + exporter.static_files, inc_repos) else: - zip_export(zip_proj, name, resource_dict, files, inc_repos) - - for static_file in exporter.static_files: - if not exists(join(export_path, basename(static_file))): - copyfile(static_file, join(export_path, basename(static_file))) + zip_export(zip_proj, name, resource_dict, + files + exporter.static_files, inc_repos) + else: + for static_file in exporter.static_files: + if not exists(join(export_path, basename(static_file))): + copyfile(static_file, join(export_path, basename(static_file))) return exporter From 382e030bdcfb2f3b58f272e65df2ee1a47f85b78 Mon Sep 17 00:00:00 2001 From: Johan Stokking Date: Tue, 25 Jul 2017 13:48:53 +0200 Subject: [PATCH 4/4] Use immutable tuple instead of mutable list Signed-off-by: Johan Stokking --- tools/export/exporters.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/export/exporters.py b/tools/export/exporters.py index dad773de5d..a81dfb34dc 100644 --- a/tools/export/exporters.py +++ b/tools/export/exporters.py @@ -61,8 +61,10 @@ class Exporter(object): self.jinja_environment = Environment(loader=jinja_loader) self.resources = resources self.generated_files = [] - self.static_files = [join(self.TEMPLATE_DIR, "GettingStarted.html"), - join(self.TEMPLATE_DIR, ".mbed")] + self.static_files = ( + join(self.TEMPLATE_DIR, "GettingStarted.html"), + join(self.TEMPLATE_DIR, ".mbed"), + ) self.builder_files_dict = {} self.add_config()