Add a sh script for esptool.py py2 detection

This commit is contained in:
Jiajie Chen 2015-03-08 07:45:29 +08:00
parent 1f83c82a2d
commit c470eade35
2 changed files with 16 additions and 1 deletions

View File

@ -75,7 +75,7 @@ else
endif endif
endif endif
############################################################# #############################################################
ESPTOOL ?= ../tools/esptool.py ESPTOOL ?= ../tools/esptool.sh
CSRCS ?= $(wildcard *.c) CSRCS ?= $(wildcard *.c)

15
tools/esptool.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
ret=`python -c 'import sys; print("%i" % (sys.hexversion<0x03000000))'`
if [ $ret -eq 0 ]; then
#Retry python 2
ret=`python2 -c 'import sys; print("%i" % (sys.hexversion<0x03000000))'`
if [ $ret -eq 0 ]; then
echo "Cannot find python2."
else
#Ok
python2 esptool.py $@
fi
else
#Ok
python esptool.py $@
fi