Skip to content

Commit

Permalink
BaseTools:Linux Python highest version check.
Browse files Browse the repository at this point in the history
Linux Python highest version check.
The path of Python interpreter assign values to PYTHON_COMMAND

Cc: Bob Feng <[email protected]>
Cc: Liming Gao <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <[email protected]>
Tested-by: Laszlo Ersek <[email protected]>
Tested-by: Ard Biesheuvel <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Reviewed-by: Bob Feng <[email protected]>
  • Loading branch information
zhijufan authored and BobCF committed Feb 1, 2019
1 parent fd2d740 commit d8238aa
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions edksetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,14 @@ function SetupPython()
{
if [ $PYTHON3_ENABLE ] && [ $PYTHON3_ENABLE == TRUE ]
then
for python in $(which python3)
if [ $origin_version ];then
origin_version=
fi
for python in $(whereis python3)
do
python=$(echo $python | grep "[[:digit:]]$" || true)
python_version=${python##*python}
if [ -z "${python_version}" ];then
if [ -z "${python_version}" ] || (! command -v $python >/dev/null 2>&1);then
continue
fi
if [ -z $origin_version ];then
Expand All @@ -137,14 +140,17 @@ function SetupPython()

if [ -z $PYTHON3_ENABLE ] || [ $PYTHON3_ENABLE != TRUE ]
then
for python in $(which python2)
if [ $origin_version ];then
origin_version=
fi
for python in $(whereis python2)
do
python=$(echo $python | grep "[[:digit:]]$" || true)
python_version=${python##*python}
if [ -z "${python_version}" ];then
if [ -z "${python_version}" ] || (! command -v $python >/dev/null 2>&1);then
continue
fi
if [ -z $origin_version ] || [ $origin_version -ge 3 ]
if [ -z $origin_version ]
then
origin_version=$python_version
export PYTHON=$python
Expand Down

0 comments on commit d8238aa

Please sign in to comment.