Add repo_dirs, repo_files, lib_builds, and lib_refs to zips

pull/2245/head
Jimmy Brisson 2016-08-24 10:29:17 -05:00
parent b5c189931e
commit a6be472111
1 changed files with 23 additions and 11 deletions

View File

@ -2,7 +2,7 @@
import sys import sys
from os.path import join, abspath, dirname, exists from os.path import join, abspath, dirname, exists
from os.path import basename, relpath, normpath from os.path import basename, relpath, normpath
from os import makedirs from os import makedirs, walk
ROOT = abspath(join(dirname(__file__), "..")) ROOT = abspath(join(dirname(__file__), ".."))
sys.path.insert(0, ROOT) sys.path.insert(0, ROOT)
import copy import copy
@ -104,16 +104,28 @@ def zip_export(file_name, prefix, resources, project_files):
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, res in resources.iteritems(): for loc, resource in resources.iteritems():
for source in \ print resource.features
res.headers + res.s_sources + res.c_sources + res.cpp_sources +\ for res in [resource] + resource.features.values():
res.libraries + res.hex_files + [res.linker_script] +\ extras = []
res.bin_files + res.objects + res.json_files: for directory in res.repo_dirs:
if source: for root, _, files in walk(directory):
zip_file.write(source, for repo_file in files:
join(prefix, loc, source = join(root, repo_file)
relpath(source, extras.append(source)
res.file_basepath[source]))) res.file_basepath[source] = res.base_path
for source in \
res.headers + res.s_sources + res.c_sources +\
res.cpp_sources + res.libraries + res.hex_files + \
[res.linker_script] + res.bin_files + res.objects + \
res.json_files + res.lib_refs + res.lib_builds + \
res.repo_files + extras:
if source:
zip_file.write(
source,
join(prefix, loc,
relpath(source, res.file_basepath[source])))
def export_project(src_paths, export_path, target, ide, def export_project(src_paths, export_path, target, ide,