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>
This commit is contained in:
Zhijux Fan 2018-12-19 13:28:44 +08:00 committed by Feng, Bob C
parent 94c912950c
commit 9c2d68c0a2
39 changed files with 177 additions and 93 deletions

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $* #python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a python2 command is available, use it in preference to python # If a ${PYTHON} command is available, use it in preference to python
if command -v python2 >/dev/null 2>&1; then if command -v ${PYTHON} >/dev/null 2>&1; then
python_exe=python2 python_exe=${PYTHON}
fi fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here

View File

@ -1,4 +1,4 @@
@setlocal @setlocal
@set ToolName=%~n0% @set ToolName=%~n0%
@set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python @set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python
@%PYTHON_HOME%\python.exe -m %ToolName%.%ToolName% %* @%PYTHON% -m %ToolName%.%ToolName% %*

View File

@ -1,4 +1,4 @@
@setlocal @setlocal
@set ToolName=%~n0% @set ToolName=%~n0%
@set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python @set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python
@%PYTHON_HOME%\python.exe -m %ToolName%.EccMain %* @%PYTHON% -m %ToolName%.EccMain %*

View File

@ -1,3 +1,3 @@
@setlocal @setlocal
@set ToolName=%~n0% @set ToolName=%~n0%
@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\AutoGen\%ToolName%.py %* @%PYTHON% %BASE_TOOLS_PATH%\Source\Python\AutoGen\%ToolName%.py %*

View File

@ -1,4 +1,4 @@
@setlocal @setlocal
@set ToolName=%~n0% @set ToolName=%~n0%
@set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python @set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python
@%PYTHON_HOME%\python.exe -m %ToolName%.%ToolName% %* @%PYTHON% -m %ToolName%.%ToolName% %*

View File

@ -1,3 +1,3 @@
@setlocal @setlocal
@set ToolName=%~n0% @set ToolName=%~n0%
@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* @%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

View File

@ -1 +1 @@
@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\Capsule\GenerateCapsule.py %* @%PYTHON% %BASE_TOOLS_PATH%\Source\Python\Capsule\GenerateCapsule.py %*

View File

@ -1,3 +1,3 @@
@setlocal @setlocal
@set ToolName=%~n0% @set ToolName=%~n0%
@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* @%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

View File

@ -1,3 +1,3 @@
@setlocal @setlocal
@set ToolName=%~n0% @set ToolName=%~n0%
@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* @%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

View File

@ -1 +1 @@
@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\Rsa2048Sha256Sign\Rsa2048Sha256GenerateKeys.py %* @%PYTHON% %BASE_TOOLS_PATH%\Source\Python\Rsa2048Sha256Sign\Rsa2048Sha256GenerateKeys.py %*

View File

@ -1,3 +1,3 @@
@setlocal @setlocal
@set ToolName=%~n0% @set ToolName=%~n0%
@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* @%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

View File

@ -1,3 +1,3 @@
@setlocal @setlocal
@set ToolName=%~n0% @set ToolName=%~n0%
@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* @%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

View File

@ -1,3 +1,3 @@
@setlocal @setlocal
@set ToolName=%~n0% @set ToolName=%~n0%
@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* @%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

View File

@ -1,3 +1,3 @@
@setlocal @setlocal
@set ToolName=%~n0% @set ToolName=%~n0%
@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* @%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

View File

@ -1,3 +1,3 @@
@setlocal @setlocal
@set ToolName=%~n0% @set ToolName=%~n0%
@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* @%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

View File

@ -20,17 +20,17 @@ SUBDIRS = $(BASE_TOOLS_PATH)\Source\C $(BASE_TOOLS_PATH)\Source\Python
all: c all: c
c : c :
@$(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $(BASE_TOOLS_PATH)\Source\C @$(PYTHON) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $(BASE_TOOLS_PATH)\Source\C
subdirs: $(SUBDIRS) subdirs: $(SUBDIRS)
@$(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $** @$(PYTHON) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $**
.PHONY: clean .PHONY: clean
clean: clean:
$(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py clean $(SUBDIRS) $(PYTHON) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py clean $(SUBDIRS)
.PHONY: cleanall .PHONY: cleanall
cleanall: cleanall:
$(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py cleanall $(SUBDIRS) $(PYTHON) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py cleanall $(SUBDIRS)

View File

@ -38,7 +38,7 @@ libs: $(LIBRARIES)
@echo # Build libraries @echo # Build libraries
@echo ###################### @echo ######################
@if not exist $(LIB_PATH) mkdir $(LIB_PATH) @if not exist $(LIB_PATH) mkdir $(LIB_PATH)
@$(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py all $** @$(PYTHON) Makefiles\NmakeSubdirs.py all $**
apps: $(APPLICATIONS) apps: $(APPLICATIONS)
@echo. @echo.
@ -46,7 +46,7 @@ apps: $(APPLICATIONS)
@echo # Build executables @echo # Build executables
@echo ###################### @echo ######################
@if not exist $(BIN_PATH) mkdir $(BIN_PATH) @if not exist $(BIN_PATH) mkdir $(BIN_PATH)
@$(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py all $** @$(PYTHON) Makefiles\NmakeSubdirs.py all $**
install: $(LIB_PATH) $(BIN_PATH) install: $(LIB_PATH) $(BIN_PATH)
@echo. @echo.
@ -60,11 +60,11 @@ install: $(LIB_PATH) $(BIN_PATH)
.PHONY: clean .PHONY: clean
clean: clean:
@$(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py clean $(LIBRARIES) $(APPLICATIONS) @$(PYTHON) Makefiles\NmakeSubdirs.py clean $(LIBRARIES) $(APPLICATIONS)
.PHONY: cleanall .PHONY: cleanall
cleanall: cleanall:
@$(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py cleanall $(LIBRARIES) $(APPLICATIONS) @$(PYTHON) Makefiles\NmakeSubdirs.py cleanall $(LIBRARIES) $(APPLICATIONS)
!INCLUDE Makefiles\ms.rule !INCLUDE Makefiles\ms.rule

View File

@ -14,7 +14,7 @@
all: test all: test
test: test:
@if command -v python2 >/dev/null 2>&1; then python2 RunTests.py; else python RunTests.py; fi @if command -v $(PYTHON) >/dev/null 1; then $(PYTHON) RunTests.py; else python RunTests.py; fi
clean: clean:
find . -name '*.pyc' -exec rm '{}' ';' find . -name '*.pyc' -exec rm '{}' ';'

View File

@ -274,8 +274,7 @@ goto check_build_environment
echo. echo.
:check_build_environment :check_build_environment
set PYTHONHASHSEED=0 set PYTHONHASHSEED=1
if defined BASETOOLS_PYTHON_SOURCE goto VisualStudioAvailable
if not defined BASE_TOOLS_PATH ( if not defined BASE_TOOLS_PATH (
if not exist "Source\C\Makefile" ( if not exist "Source\C\Makefile" (
@ -286,24 +285,60 @@ goto check_build_environment
) )
) )
if not defined PYTHON_HOME ( :defined_python
if defined PYTHONHOME ( if defined PYTHON3_ENABLE (
set PYTHON_HOME=%PYTHONHOME% if "%PYTHON3_ENABLE%" EQU "TRUE" (
) else ( set PYTHON=py -3
%PYTHON% --version >NUL 2>&1
if %ERRORLEVEL% NEQ 0 (
echo. echo.
echo !!! ERROR !!! Binary python tools are missing. PYTHON_HOME environment variable is not set. echo !!! ERROR !!! PYTHON3 is not installed or added to environment variables
echo PYTHON_HOME is required to build or execute the python tools.
echo. echo.
goto end goto end
) else (
goto check_freezer_path
)
)
)
if defined PYTHON_HOME (
if EXIST "%PYTHON_HOME%" (
set PYTHON=%PYTHON_HOME%\python.exe
goto check_freezer_path
) )
) )
if defined PYTHONHOME (
if EXIST "%PYTHONHOME%" (
set PYTHON_HOME=%PYTHONHOME%
set PYTHON=%PYTHON_HOME%\python.exe
goto check_freezer_path
)
)
echo.
echo !!! ERROR !!! Binary python tools are missing.
echo PYTHON_HOME or PYTHON3_ENABLE environment variable is not set successfully.
echo PYTHON_HOME or PYTHON3_ENABLE is required to build or execute the python tools.
echo.
goto end
:check_freezer_path
if defined BASETOOLS_PYTHON_SOURCE goto print_python_info
set "PATH=%BASE_TOOLS_PATH%\BinWrappers\WindowsLike;%PATH%" set "PATH=%BASE_TOOLS_PATH%\BinWrappers\WindowsLike;%PATH%"
set BASETOOLS_PYTHON_SOURCE=%BASE_TOOLS_PATH%\Source\Python set BASETOOLS_PYTHON_SOURCE=%BASE_TOOLS_PATH%\Source\Python
set PYTHONPATH=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH% set PYTHONPATH=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH%
:print_python_info
echo PATH = %PATH% echo PATH = %PATH%
echo PYTHON_HOME = %PYTHON_HOME% if "%PYTHON3_ENABLE%" EQU "TRUE" (
echo PYTHON3_ENABLE = %PYTHON3_ENABLE%
echo PYTHON3 = %PYTHON%
) else (
echo PYTHON3_ENABLE = %PYTHON3_ENABLE%
if defined PYTHON_HOME (
echo PYTHON_HOME = %PYTHON_HOME%
)
)
echo PYTHONPATH = %PYTHONPATH% echo PYTHONPATH = %PYTHONPATH%
echo. echo.

View File

@ -77,7 +77,7 @@ function SetWorkspace()
# Set $WORKSPACE # Set $WORKSPACE
# #
export WORKSPACE=`pwd` export WORKSPACE=`pwd`
export PYTHONHASHSEED=0 export PYTHONHASHSEED=1
return 0 return 0
} }
@ -111,10 +111,59 @@ function SetupEnv()
fi 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() function SourceEnv()
{ {
SetWorkspace && SetWorkspace &&
SetupEnv SetupEnv
SetupPython
} }
I=$# I=$#