-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathesptool.py
More file actions
executable file
·71 lines (66 loc) · 2.47 KB
/
esptool.py
File metadata and controls
executable file
·71 lines (66 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh
createVenv()
{
python3 -I -s --version 2>/dev/null >/dev/null
if [ "$?" != 0 ]; then
echo "python3 is not installed"
echo "on macos : please download latest python3 from https://www.python.org/ and install"
echo "on debian like linux: sudo apt-get install python3 python3-pip python3-venv"
echo "on redhat like linux: sudo dnf install python3 python3-pip python3-venv"
exit 1
fi
python3 -I -m pip -h 2>&1 >/dev/null
if [ "$?" != 0 ]; then
echo "python3 module 'pip' is not installed, please fix"
echo "on debian like linux: sudo apt-get install python3-pip"
echo "on redhat like linux: sudo dnf install python3-pip"
exit 1
fi
python3 -I -m venv -h 2>&1 >/dev/null
if [ "$?" != 0 ]; then
echo "python3 module 'venv' is not installed, please fix"
echo "on debian like linux: sudo apt-get install python3-venv"
echo "on redhat like linux: sudo dnf install python3-venv"
exit 1
fi
rm -rf $IDF_PATH/venv
python3 -m venv $IDF_PATH/venv
if [ ! -f $ACTIVATE ]; then
echo "Error: Could not create virtual env"
echo "please create an issue on https://github.com/michael-ring/espsdk4fpc/issues and paste the following output:"
python3 -m venv $IDF_PATH/venv
exit 1
fi
. $IDF_PATH/venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install -r $IDF_PATH/requirements.txt
if [ "$?" != 0 ]; then
echo "Setting up modules for venv failed"
echo "please create an issue on https://github.com/michael-ring/espsdk4fpc/issues and paste the following output:"
python3 -m pip install -r $IDF_PATH/requirements.txt
exit 1
fi
}
IDF_PATH=$(dirname $(dirname $(dirname $(dirname $0))))
echo "(1023) IDF_PATH is $IDF_PATH"
export IDF_PATH
if [ ! -f $IDF_PATH/venv/bin/activate ]; then
# we do not have a venv, create it
createVenv
fi
ls -Ll $IDF_PATH/venv/bin/python3 2>&1 | grep "1" >/dev/null
if [ "$?" != 0 ]; then
# venv is outdated and points to a deleted version of python
echo "(1023) refreshing outdated venv"
createVenv
fi
. $IDF_PATH/venv/bin/activate
PATH=$IDF_PATH/tools:$PATH
export PATH
python3 $IDF_PATH/components/esptool_py/esptool/esptool-orig.py -h 2>/dev/null >/dev/null
if [ "$?" != 0 ]; then
# something ist wrong, refresh the venv...
echo "(1023) refreshing outdated venv, if you see this on every compile then create an issue on https://github.com/michael-ring/espsdk4fpc/issues"
createVenv
fi
python3 $IDF_PATH/components/esptool_py/esptool/esptool-orig.py "$@"