Skip to content

Commit 3e2526a

Browse files
committed
Made exporting safer
it will no longer barf when: - a linker scirpt is None - an attribute that is a set it will also export the correct library include paths
1 parent 67fae3a commit 3e2526a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tools/project_api.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,18 @@ def subtract_basepath(resources, export_path):
4545
generated project files
4646
"""
4747
keys = ['s_sources', 'c_sources', 'cpp_sources', 'hex_files',
48-
'objects', 'libraries', 'inc_dirs', 'headers', 'linker_script']
48+
'objects', 'libraries', 'inc_dirs', 'headers', 'linker_script',
49+
'lib_dirs']
4950
for key in keys:
5051
vals = getattr(resources, key)
52+
if type(vals) is set:
53+
vals = list(vals)
5154
if type(vals) is list:
5255
new_vals = []
5356
for val in vals:
5457
new_vals.append(rewrite_basepath(val, resources, export_path))
5558
setattr(resources, key, new_vals)
56-
else:
59+
elif vals:
5760
setattr(resources, key, rewrite_basepath(vals, resources,
5861
export_path))
5962

@@ -150,9 +153,11 @@ def zip_export(file_name, prefix, resources, project_files):
150153
resources.libraries + resources.hex_files + \
151154
[resources.linker_script] + resources.bin_files \
152155
+ resources.objects + resources.json_files:
153-
zip_file.write(source,
154-
join(prefix, relpath(source,
155-
resources.file_basepath[source])))
156+
if source:
157+
zip_file.write(source,
158+
join(prefix,
159+
relpath(source,
160+
resources.file_basepath[source])))
156161

157162

158163
def export_project(src_paths, export_path, target, ide,

0 commit comments

Comments
 (0)