1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

Clean up uploader.py, use implied paths (#5805)

No need to explicitly send in full paths for esptool and pyserial Python
libs because they're in well known locations relative to upload.py.

Make upload.py calculate these on-the-fly and clean up platform.txt.
This commit is contained in:
Earle F. Philhower, III
2019-02-21 21:40:45 +00:00
committed by GitHub
parent 472faf73a2
commit 53f51b5811
2 changed files with 5 additions and 3 deletions

View File

@ -7,11 +7,13 @@
# i.e. upload.py tools/pyserial tools/esptool erase_flash --end write_flash file 0x0 --end
import sys
import os
sys.argv.pop(0) # Remove executable name
toolspath = os.path.dirname(os.path.realpath(__file__)).replace('\\', '/') # CWD in UNIX format
try:
sys.path.append(sys.argv.pop(0).replace('\\', '/')) # Add pyserial dir to search path, in UNIX format
sys.path.append(sys.argv.pop(0).replace('\\', '/')) # Add esptool dir to search path, in UNIX format
sys.path.append(toolspath + "/pyserial") # Add pyserial dir to search path
sys.path.append(toolspath + "/esptool") # Add esptool dir to search path
import esptool # If this fails, we can't continue and will bomb below
except:
sys.stderr.write("Error in command line, need pyserial path as 1st arg and esptool path as 2nd.\n")