File tree 3 files changed +18
-9
lines changed
3 files changed +18
-9
lines changed Original file line number Diff line number Diff line change 18
18
# Linux/macOS: remove current script directory to avoid importing this file
19
19
# as a module; we want to import the installed espefuse module instead
20
20
with contextlib .suppress (ValueError ):
21
- if sys .path [0 ].endswith ("/bin" ):
22
- sys .path .pop (0 )
23
- sys .path .remove (os .path .dirname (sys .executable ))
21
+ executable_dir = os .path .dirname (sys .executable )
22
+ sys .path = [
23
+ path
24
+ for path in sys .path
25
+ if not path .endswith (("/bin" , "/sbin" )) and path != executable_dir
26
+ ]
24
27
25
28
# Linux/macOS: delete imported module entry to force Python to load
26
29
# the module from scratch; this enables importing espefuse module in
Original file line number Diff line number Diff line change 18
18
# Linux/macOS: remove current script directory to avoid importing this file
19
19
# as a module; we want to import the installed espsecure module instead
20
20
with contextlib .suppress (ValueError ):
21
- if sys .path [0 ].endswith ("/bin" ):
22
- sys .path .pop (0 )
23
- sys .path .remove (os .path .dirname (sys .executable ))
21
+ executable_dir = os .path .dirname (sys .executable )
22
+ sys .path = [
23
+ path
24
+ for path in sys .path
25
+ if not path .endswith (("/bin" , "/sbin" )) and path != executable_dir
26
+ ]
24
27
25
28
# Linux/macOS: delete imported module entry to force Python to load
26
29
# the module from scratch; this enables importing espsecure module in
Original file line number Diff line number Diff line change 18
18
# Linux/macOS: remove current script directory to avoid importing this file
19
19
# as a module; we want to import the installed esptool module instead
20
20
with contextlib .suppress (ValueError ):
21
- if sys .path [0 ].endswith ("/bin" ):
22
- sys .path .pop (0 )
23
- sys .path .remove (os .path .dirname (sys .executable ))
21
+ executable_dir = os .path .dirname (sys .executable )
22
+ sys .path = [
23
+ path
24
+ for path in sys .path
25
+ if not path .endswith (("/bin" , "/sbin" )) and path != executable_dir
26
+ ]
24
27
25
28
# Linux/macOS: delete imported module entry to force Python to load
26
29
# the module from scratch; this enables importing esptool module in
You can’t perform that action at this time.
0 commit comments