Skip to content

Commit c1ee07f

Browse files
committed
messing with the esp32 build
1 parent f0eecb3 commit c1ee07f

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

builder/esp32.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def build_commands(_, extra_args, __, lv_cflags, ___):
238238

239239
def get_idf_version():
240240
if 'ESP_IDF_VERSION' in os.environ:
241-
exit_code, data = spawn(['idf.py', '--version'], out_to_screen=False)
241+
exit_code, data = spawn(['python3', 'idf.py', '--version'], out_to_screen=False)
242242
version = data.split('v')[-1].split('-')[0]
243243
if version:
244244
return version
@@ -299,7 +299,7 @@ def setup_idf_environ():
299299
py_path = os.path.split(sys.executable)[0]
300300
idf_path = os.path.abspath(idf_path)
301301
idf_tools_path = os.path.join(idf_path, 'tools')
302-
env['PATH'] = py_path + os.pathsep + idf_path + os.pathsep + idf_tools_path + os.pathsep + env.get('PATH', '')
302+
env['PATH'] = py_path + os.pathsep + os.pathsep + idf_tools_path + os.pathsep + env.get('PATH', '')
303303
env['IDF_PATH'] = idf_path
304304

305305
if 'GITHUB_RUN_ID' in env:
@@ -317,7 +317,6 @@ def setup_idf_environ():
317317
['echo', f"{py_path}", '>>', '$GITHUB_PATH'],
318318
['echo', f"{idf_path}", '>>', '$GITHUB_PATH'],
319319
['echo', f"{idf_tools_path}", '>>', '$GITHUB_PATH']
320-
321320
]
322321

323322
spawn(env_cmds, env=env, out_to_screen=False)
@@ -461,7 +460,16 @@ def compile(): # NOQA
461460
else:
462461
deploy = False
463462

464-
ret_code, output = spawn(compile_cmd, env=env, cmpl=True)
463+
cmds = [['cd', 'lib/esp-idf']]
464+
465+
if sys.platform.startswith('win'):
466+
cmds.append(['export'])
467+
else:
468+
cmds.append(['. ./export.sh'])
469+
cmds.append(['cd ../..'])
470+
cmds.append(compile_cmd)
471+
472+
ret_code, output = spawn(cmds, env=env, cmpl=True)
465473
if ret_code != 0:
466474
if (
467475
'partition is too small ' not in output or
@@ -496,7 +504,7 @@ def compile(): # NOQA
496504
compile_cmd.append('deploy')
497505

498506
compile_cmd[4] = 'SECOND_BUILD=1'
499-
ret_code, output = spawn(compile_cmd, env=env, cmpl=True)
507+
ret_code, output = spawn(cmds, env=env, cmpl=True)
500508

501509
if ret_code != 0:
502510
sys.exit(ret_code)
@@ -551,7 +559,7 @@ def compile(): # NOQA
551559
if remaining > 4096 or partition_size != -1 or deploy:
552560
compile_cmd[4] = 'SECOND_BUILD=1'
553561

554-
ret_code, output = spawn(compile_cmd, env=env, cmpl=True)
562+
ret_code, output = spawn(cmds, env=env, cmpl=True)
555563

556564
if ret_code != 0:
557565
sys.exit(ret_code)
@@ -603,7 +611,16 @@ def compile(): # NOQA
603611
cmd = cmd.replace('--before default_reset ', '')
604612
cmd = cmd.replace('--after no_reset ', '')
605613

606-
result, _ = spawn([cmd])
614+
cmds = [['cd', 'lib/esp-idf']]
615+
616+
if sys.platform.startswith('win'):
617+
cmds.append(['export'])
618+
else:
619+
cmds.append(['. ./export.sh'])
620+
cmds.append(['cd ../..'])
621+
cmds.append([cmd])
622+
623+
result, _ = spawn(cmds)
607624
if result:
608625
sys.exit(result)
609626

0 commit comments

Comments
 (0)