Skip to content

Commit 5092891

Browse files
author
Bin Zhang
authored
Merge pull request #395 from kosmosR2/v3
Control python version in start script.
2 parents 8d30a6f + 74f0ca3 commit 5092891

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

bin/cocos

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,24 @@
33
COCOS_CONSOLE_BIN_DIRECTORY=$(dirname "$0")
44
COCOS_CONSOLE_BIN_DIRECTORY=$(cd "$COCOS_CONSOLE_BIN_DIRECTORY" && pwd -P)
55

6-
python "$COCOS_CONSOLE_BIN_DIRECTORY/cocos.py" "$@"
6+
7+
if hash python2 2>/dev/null; then
8+
PYTHON=python2
9+
else
10+
if hash python 2>/dev/null; then
11+
VERSION="python --version"
12+
if $VERSION 2>&1 >/dev/null | grep "Python 2" ; then
13+
PYTHON=python
14+
else
15+
echo "require Python 2,but $($VERSION) found"
16+
exit 1;
17+
fi
18+
else
19+
echo "Python 2 required."
20+
exit 1
21+
fi
22+
fi
23+
24+
25+
$PYTHON "$COCOS_CONSOLE_BIN_DIRECTORY/cocos.py" "$@"
726

0 commit comments

Comments
 (0)