diff options
author | Zhijux Fan <zhijux.fan@intel.com> | 2018-12-19 13:28:44 +0800 |
---|---|---|
committer | Feng, Bob C <bob.c.feng@intel.com> | 2019-02-01 11:09:22 +0800 |
commit | 9c2d68c0a29909d23266395fc48d0b81b118e341 (patch) | |
tree | 7d5600bbae95ee71ac5ff416d1a285c49732f098 /edksetup.sh | |
parent | 94c912950c2f588ab8c3725d7aaa3d7c07aaa995 (diff) | |
download | edk2-9c2d68c0a29909d23266395fc48d0b81b118e341.tar.gz |
BaseTools: Update windows and linux run scripts file to use Python3
Modify windows script, PosixLike script, edksetup.sh, edksetup.bat to
use Python3 based on PYTHON3_ENABLE environment.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Diffstat (limited to 'edksetup.sh')
-rwxr-xr-x | edksetup.sh | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/edksetup.sh b/edksetup.sh index 3dee8c5d61..06f95f4b9c 100755 --- a/edksetup.sh +++ b/edksetup.sh @@ -77,7 +77,7 @@ function SetWorkspace() # Set $WORKSPACE # export WORKSPACE=`pwd` - export PYTHONHASHSEED=0
+ export PYTHONHASHSEED=1 return 0 } @@ -111,10 +111,59 @@ function SetupEnv() fi } +function SetupPython() +{ + if [ $PYTHON3_ENABLE ] && [ $PYTHON3_ENABLE == TRUE ] + then + for python in $(which python3) + do + python=$(echo $python | grep "[[:digit:]]$" || true) + python_version=${python##*python} + if [ -z "${python_version}" ];then + continue + fi + if [ -z $origin_version ];then + origin_version=$python_version + export PYTHON=$python + continue + fi + ret=`echo "$origin_version < $python_version" |bc` + if [ "$ret" -eq 1 ]; then + origin_version=$python_version + export PYTHON=$python + fi + done + fi + + if [ -z $PYTHON3_ENABLE ] || [ $PYTHON3_ENABLE != TRUE ] + then + for python in $(which python2) + do + python=$(echo $python | grep "[[:digit:]]$" || true) + python_version=${python##*python} + if [ -z "${python_version}" ];then + continue + fi + if [ -z $origin_version ] || [ $origin_version -ge 3 ] + then + origin_version=$python_version + export PYTHON=$python + continue + fi + ret=`echo "$origin_version < $python_version" |bc` + if [ "$ret" -eq 1 ]; then + origin_version=$python_version + export PYTHON=$python + fi + done + fi +} + function SourceEnv() { SetWorkspace && SetupEnv + SetupPython } I=$# |