Skip to content

Resolve Windows path problems #8860

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 8 commits into from
Feb 22, 2023
Merged
Next Next commit
Moved up os.makedirs for core directory.
Strange problem creating files with file paths with spaces.

Added try/except catch on main to commit print buffer for context of traceback.
  • Loading branch information
mhightower83 committed Feb 17, 2023
commit bc1e64219e5bb118fb7b9a28e2cf83b1ff16be7c
18 changes: 12 additions & 6 deletions tools/mkbuildoptglobals.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
import glob
import os
import platform
import traceback
import sys
import textwrap
import time
Expand Down Expand Up @@ -305,7 +306,6 @@ def add_include_line(build_opt_fqfn, include_fqfn):
with open(build_opt_fqfn, 'a', encoding="utf-8") as build_opt:
build_opt.write('-include "' + include_fqfn.replace('\\', '\\\\') + '"\n')


def extract_create_build_opt_file(globals_h_fqfn, file_name, build_opt_fqfn):
"""
Extract the embedded build.opt from Sketch.ino.globals.h into build
Expand Down Expand Up @@ -655,6 +655,10 @@ def main():
print_dbg(f"first_time: {first_time}")
print_dbg(f"use_aggressive_caching_workaround: {use_aggressive_caching_workaround}")

if not os.path.exists(build_path_core):
os.makedirs(build_path_core)
print_msg("Clean build, created dir " + build_path_core)

if first_time or \
not use_aggressive_caching_workaround or \
not os.path.exists(commonhfile_fqfn):
Expand All @@ -667,10 +671,6 @@ def main():
touch(commonhfile_fqfn)
print_err(f"Neutralized future timestamp on build file: {commonhfile_fqfn}")

if not os.path.exists(build_path_core):
os.makedirs(build_path_core)
print_msg("Clean build, created dir " + build_path_core)

if os.path.exists(source_globals_h_fqfn):
print_msg("Using global include from " + source_globals_h_fqfn)

Expand Down Expand Up @@ -750,4 +750,10 @@ def main():
handle_error(0) # commit print buffer

if __name__ == '__main__':
sys.exit(main())
rc = 1
try:
rc = main()
except:
print_err(traceback.format_exc())
handle_error(0)
sys.exit(rc)