Skip to content

Copy static files only #4804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 27, 2017
Merged

Copy static files only #4804

merged 4 commits into from
Jul 27, 2017

Conversation

johanstokking
Copy link
Contributor

@johanstokking johanstokking commented Jul 24, 2017

Signed-off-by: Johan Stokking [email protected] (ARM mbed OS developer site username johanstokking)

Description

Closes #4802
Replaces #4803

Status

READY

Signed-off-by: Johan Stokking <[email protected]>
Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This misses the True part of the

if zip_proj

conditional. Could you change that branch to account for the new static_files too?

@theotherjimmy
Copy link
Contributor

That's not really what I meant. It's meaningless to copy files around when the export product is the zip file. I meant something like:

 if zip_proj:
         for resource in resource_dict.values():
             for label, res in resource.features.iteritems():
                 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 + exporter.static_files,
                        inc_repos)
         else:
             zip_export(zip_proj, name, resource_dict, files + exporter.static_files, inc_repos)

Which would add the static files to the zip

@Nodraak
Copy link
Contributor

Nodraak commented Jul 25, 2017

Hi!

First of all, thank you for your contribution!

As part of my "improve mbed's Python code quality" quest, I will kindly ask you to rewrite in favour of a more pythonic way: (the trailing coma on line 3 is intentional, and we can use ( instead of [ for imutable tuple instead of mutable list)

self.static_files = (
    join(self.TEMPLATE_DIR, "GettingStarted.html"),
    join(self.TEMPLATE_DIR, ".mbed"),
)

instead of

self.static_files = [join(self.TEMPLATE_DIR, "GettingStarted.html"),
                     join(self.TEMPLATE_DIR, ".mbed")]

Thank you :)

@johanstokking
Copy link
Contributor Author

johanstokking commented Jul 25, 2017

@theotherjimmy got it, makes totally sense

@Nodraak these are my first lines of Python, thanks for the education 😉

@theotherjimmy
Copy link
Contributor

@Nodraak

the trailing coma on line 3 is intentional, and we can use ( instead of [ for imutable tuple instead of mutable list

The trailing coma is not required to use ( to create a tuple. However, I prefer your style advice. Just wanted to make sure that @johanstokking got correct information.

Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks for the fix!

@theotherjimmy
Copy link
Contributor

/morph export-build

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph export-build

Output

mbed Build Number: 93

All exports and builds passed!

@theotherjimmy
Copy link
Contributor

Thanks for the fix @johanstokking! It's a big improvement.

@johanstokking johanstokking deleted the fix/4802-copy-static-files branch August 1, 2017 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants