Merge pull request #3765 from theotherjimmy/remove-zip-dupes

Remove duplicate files in zipped exports
pull/3798/head
Sam Grove 2017-02-17 09:19:12 -06:00 committed by GitHub
commit 9ea5702634
1 changed files with 32 additions and 28 deletions

View File

@ -104,8 +104,7 @@ def zip_export(file_name, prefix, resources, project_files, inc_repos):
with zipfile.ZipFile(file_name, "w") as zip_file: with zipfile.ZipFile(file_name, "w") as zip_file:
for prj_file in project_files: for prj_file in project_files:
zip_file.write(prj_file, join(prefix, basename(prj_file))) zip_file.write(prj_file, join(prefix, basename(prj_file)))
for loc, resource in resources.iteritems(): for loc, res in resources.iteritems():
for res in [resource] + resource.features.values():
to_zip = ( to_zip = (
res.headers + res.s_sources + res.c_sources +\ res.headers + res.s_sources + res.c_sources +\
res.cpp_sources + res.libraries + res.hex_files + \ res.cpp_sources + res.libraries + res.hex_files + \
@ -223,8 +222,13 @@ def export_project(src_paths, export_path, target, ide, libraries_paths=None,
macros=macros) macros=macros)
files.append(config_header) files.append(config_header)
if zip_proj: 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): 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,
inc_repos)
else: else:
zip_export(zip_proj, name, resource_dict, files, inc_repos) zip_export(zip_proj, name, resource_dict, files, inc_repos)