@@ -297,33 +297,31 @@ def setup_idf_environ():
297
297
# has the ESP-IDF installed
298
298
env = {k : v for k , v in os .environ .items () if not k .startswith ('IDF' )}
299
299
py_path = os .path .split (sys .executable )[0 ]
300
+ idf_path = os .path .abspath (idf_path )
301
+ 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' , '' )
303
+ env ['IDF_PATH' ] = idf_path
300
304
301
305
if 'GITHUB_RUN_ID' in env :
302
306
if sys .platform .startswith ('win' ):
303
307
env_cmds = [
304
308
['echo' , f"{ py_path } " , '|' , 'Out-File' , '-Append' ,
305
309
'-FilePath' , '$env:GITHUB_PATH' , '-Encoding' , 'utf8' ],
306
- ['echo' , f"{ os .path .abspath (idf_path )} " , '|' , 'Out-File' , '-Append' ,
310
+ ['echo' , f"{ idf_path } " , '|' , 'Out-File' , '-Append' ,
311
+ '-FilePath' , '$env:GITHUB_PATH' , '-Encoding' , 'utf8' ],
312
+ ['echo' , f"{ idf_tools_path } " , '|' , 'Out-File' , '-Append' ,
307
313
'-FilePath' , '$env:GITHUB_PATH' , '-Encoding' , 'utf8' ]
308
314
]
309
315
else :
310
316
env_cmds = [
311
317
['echo' , f"{ py_path } " , '>>' , '$GITHUB_PATH' ],
312
- ['echo' , f"{ os .path .abspath (idf_path )} " , '>>' , '$GITHUB_PATH' ]
318
+ ['echo' , f"{ idf_path } " , '>>' , '$GITHUB_PATH' ],
319
+ ['echo' , f"{ idf_tools_path } " , '>>' , '$GITHUB_PATH' ]
320
+
313
321
]
314
322
315
323
spawn (env_cmds , env = env , out_to_screen = False )
316
324
317
- env ['IDF_PATH' ] = os .path .abspath (idf_path )
318
-
319
- if 'PATH' in env :
320
- env ['PATH' ] = py_path + os .pathsep + env ['PATH' ]
321
- elif 'path' in env :
322
- env ['PATH' ] = py_path + os .pathsep + env ['path' ]
323
- del env ['path' ]
324
- else :
325
- env ['PATH' ] = py_path + os .pathsep
326
-
327
325
result , output = spawn (cmds , env = env , out_to_screen = False )
328
326
329
327
if result != 0 :
0 commit comments