Skip to content

Preventing a traceback when a library is not built during export #2166

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 1 commit into from
Jul 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions tools/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,19 @@
for mcu in options.mcu:
# Program Number or name
p, src, ide = options.program, options.source_dir, options.ide
project_dir, project_name, project_temp = setup_project(mcu, ide, p, src, options.build)

zip = not bool(src) # create zip when no src_dir provided
clean = not bool(src) # don't clean when source is provided, use acrual source tree for IDE files

# Export to selected toolchain
lib_symbols = get_lib_symbols(options.macros, src, p)
tmp_path, report = export(project_dir, project_name, ide, mcu, project_dir[0], project_temp, clean=clean, make_zip=zip, extra_symbols=lib_symbols, sources_relative=sources_relative)
try:
project_dir, project_name, project_temp = setup_project(mcu, ide, p, src, options.build)
zip = not bool(src) # create zip when no src_dir provided
clean = not bool(src) # don't clean when source is provided, use acrual source tree for IDE files

# Export to selected toolchain
lib_symbols = get_lib_symbols(options.macros, src, p)
tmp_path, report = export(project_dir, project_name, ide, mcu, project_dir[0], project_temp, clean=clean, make_zip=zip, extra_symbols=lib_symbols, sources_relative=sources_relative)
except OSError as e:
if e.errno == 2:
report = dict(success=False, errormsg="Library path '%s' does not exist. Ensure that the library is built." % (e.filename))
else:
report = dict(success=False, errormsg="An OS error occured: errno #{}".format(e.errno))
if report['success']:
if not zip:
zip_path = join(project_temp, project_name)
Expand Down