From 1ccc4d895dd8d659d016efcd6ef8a48749aba1d0 Mon Sep 17 00:00:00 2001 From: Liming Gao Date: Mon, 15 Oct 2018 08:27:53 +0800 Subject: [PATCH] Revert BaseTools: PYTHON3 migration This reverts commit 6693f359b3c213513c5096a06c6f67244a44dc52.. 678f85131238622e576705117e299d81cff755c9. Python3 migration is the fundamental change. It requires every developer to install Python3. Before this migration, the well communication and wide verification must be done. But now, most people is not aware of this change, and not try it. So, Python3 migration is reverted and be moved to edk2-staging Python3 branch for the edk2 user evaluation. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao --- BaseTools/Bin/CYGWIN_NT-5.1-i686/Ecc | 6 +- BaseTools/Bin/CYGWIN_NT-5.1-i686/GenDepex | 6 +- BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFds | 6 +- BaseTools/Bin/CYGWIN_NT-5.1-i686/TargetTool | 6 +- BaseTools/Bin/CYGWIN_NT-5.1-i686/Trim | 6 +- BaseTools/Bin/CYGWIN_NT-5.1-i686/build | 6 +- BaseTools/BinWrappers/PosixLike/BPDG | 6 +- BaseTools/BinWrappers/PosixLike/Ecc | 6 +- BaseTools/BinWrappers/PosixLike/GenDepex | 6 +- BaseTools/BinWrappers/PosixLike/GenFds | 6 +- .../BinWrappers/PosixLike/GenPatchPcdTable | 6 +- .../BinWrappers/PosixLike/GenerateCapsule | 6 +- BaseTools/BinWrappers/PosixLike/PatchPcdValue | 6 +- BaseTools/BinWrappers/PosixLike/Pkcs7Sign | 6 +- .../PosixLike/Rsa2048Sha256GenerateKeys | 6 +- .../BinWrappers/PosixLike/Rsa2048Sha256Sign | 6 +- BaseTools/BinWrappers/PosixLike/TargetTool | 6 +- BaseTools/BinWrappers/PosixLike/Trim | 6 +- BaseTools/BinWrappers/PosixLike/UPT | 6 +- BaseTools/BinWrappers/PosixLike/build | 6 +- BaseTools/BinWrappers/WindowsLike/BPDG.bat | 2 +- BaseTools/BinWrappers/WindowsLike/Ecc.bat | 2 +- .../BinWrappers/WindowsLike/GenDepex.bat | 2 +- BaseTools/BinWrappers/WindowsLike/GenFds.bat | 2 +- .../WindowsLike/GenPatchPcdTable.bat | 2 +- .../WindowsLike/GenerateCapsule.bat | 2 +- .../BinWrappers/WindowsLike/PatchPcdValue.bat | 2 +- .../BinWrappers/WindowsLike/Pkcs7Sign.bat | 2 +- .../WindowsLike/Rsa2048Sha256GenerateKeys.bat | 2 +- .../WindowsLike/Rsa2048Sha256Sign.bat | 2 +- .../BinWrappers/WindowsLike/TargetTool.bat | 2 +- BaseTools/BinWrappers/WindowsLike/Trim.bat | 2 +- BaseTools/BinWrappers/WindowsLike/UPT.bat | 2 +- BaseTools/BinWrappers/WindowsLike/build.bat | 2 +- BaseTools/Makefile | 14 +- .../Scripts/PackageDocumentTools/Readme.md | 4 +- .../PackageDocumentTools/packagedoc_cli.py | 7 +- .../PackageDocumentTools/packagedocapp.pyw | 54 +- .../plugins/EdkPlugins/basemodel/doxygen.py | 8 +- .../plugins/EdkPlugins/basemodel/efibinary.py | 1 + .../plugins/EdkPlugins/basemodel/ini.py | 5 +- .../EdkPlugins/edk2/model/baseobject.py | 14 +- .../plugins/EdkPlugins/edk2/model/dec.py | 4 +- .../EdkPlugins/edk2/model/doxygengen.py | 12 +- .../EdkPlugins/edk2/model/doxygengen_spec.py | 12 +- .../plugins/EdkPlugins/edk2/model/dsc.py | 4 +- .../plugins/EdkPlugins/edk2/model/inf.py | 4 +- BaseTools/Source/C/Makefile | 8 +- BaseTools/Source/C/PyUtility/Makefile | 25 + BaseTools/Source/C/PyUtility/PyUtility.c | 106 + BaseTools/Source/C/PyUtility/setup.py | 42 + .../Source/C/TianoCompress/TianoCompress.c | 81 +- .../Source/C/TianoCompress/TianoCompress.h | 2 +- BaseTools/Source/Python/AutoGen/AutoGen.py | 107 +- .../Source/Python/AutoGen/BuildEngine.py | 1 + BaseTools/Source/Python/AutoGen/GenC.py | 26 +- BaseTools/Source/Python/AutoGen/GenMake.py | 43 +- BaseTools/Source/Python/AutoGen/GenPcdDb.py | 53 +- BaseTools/Source/Python/AutoGen/GenVar.py | 26 +- .../Source/Python/AutoGen/IdfClassObject.py | 1 + .../Source/Python/AutoGen/InfSectionParser.py | 2 +- BaseTools/Source/Python/AutoGen/StrGather.py | 7 +- .../Source/Python/AutoGen/UniClassObject.py | 15 +- .../Python/AutoGen/ValidCheckingInfoObject.py | 10 +- BaseTools/Source/Python/BPDG/BPDG.py | 2 + BaseTools/Source/Python/BPDG/GenVpd.py | 26 +- BaseTools/Source/Python/Common/Database.py | 1 + BaseTools/Source/Python/Common/EdkLogger.py | 1 + BaseTools/Source/Python/Common/Expression.py | 17 +- .../Source/Python/Common/LongFilePathOs.py | 4 +- .../Python/Common/LongFilePathSupport.py | 14 +- BaseTools/Source/Python/Common/Misc.py | 85 +- BaseTools/Source/Python/Common/Parsing.py | 1 + BaseTools/Source/Python/Common/PyUtility.pyd | Bin 0 -> 6144 bytes .../Source/Python/Common/RangeExpression.py | 3 +- BaseTools/Source/Python/Common/StringUtils.py | 19 +- .../Python/Common/TargetTxtClassObject.py | 2 + .../Python/Common/ToolDefClassObject.py | 1 + BaseTools/Source/Python/Common/VpdInfoFile.py | 11 +- BaseTools/Source/Python/Ecc/C.g4 | 636 - BaseTools/Source/Python/Ecc/CLexer.py | 5527 +++- BaseTools/Source/Python/Ecc/CListener.py | 672 - BaseTools/Source/Python/Ecc/CParser.py | 22522 ++++++++++++---- BaseTools/Source/Python/Ecc/Check.py | 4 +- .../Python/Ecc/CodeFragmentCollector.py | 11 +- BaseTools/Source/Python/Ecc/EccMain.py | 2 +- BaseTools/Source/Python/Ecc/FileProfile.py | 2 +- BaseTools/Source/Python/Ecc/MetaDataParser.py | 2 +- BaseTools/Source/Python/Ecc/c.py | 6 +- BaseTools/Source/Python/Eot/CLexer.py | 5527 +++- BaseTools/Source/Python/Eot/CListener.py | 672 - BaseTools/Source/Python/Eot/CParser.py | 22522 ++++++++++++---- .../Python/Eot/CodeFragmentCollector.py | 2 +- .../Source/Python/Eot/{EotMain.py => Eot.py} | 465 +- BaseTools/Source/Python/Eot/InfParserLite.py | 22 +- BaseTools/Source/Python/Eot/Parser.py | 28 +- BaseTools/Source/Python/Eot/Report.py | 6 +- .../Source/Python/GenFds/AprioriSection.py | 5 +- BaseTools/Source/Python/GenFds/Capsule.py | 6 +- BaseTools/Source/Python/GenFds/CapsuleData.py | 5 +- .../Source/Python/GenFds/CompressSection.py | 1 + BaseTools/Source/Python/GenFds/DataSection.py | 5 +- .../Source/Python/GenFds/DepexSection.py | 1 + BaseTools/Source/Python/GenFds/EfiSection.py | 5 +- BaseTools/Source/Python/GenFds/Fd.py | 5 +- BaseTools/Source/Python/GenFds/FdfParser.py | 24 +- .../Source/Python/GenFds/FfsFileStatement.py | 15 +- .../Source/Python/GenFds/FfsInfStatement.py | 19 +- BaseTools/Source/Python/GenFds/Fv.py | 14 +- .../Source/Python/GenFds/FvImageSection.py | 17 +- BaseTools/Source/Python/GenFds/GenFds.py | 26 +- .../Python/GenFds/GenFdsGlobalVariable.py | 5 +- BaseTools/Source/Python/GenFds/GuidSection.py | 1 + .../Python/GenFds/OptRomFileStatement.py | 1 + .../Python/GenFds/OptRomInfStatement.py | 1 + BaseTools/Source/Python/GenFds/OptionRom.py | 1 + BaseTools/Source/Python/GenFds/Region.py | 11 +- .../Source/Python/GenFds/RuleComplexFile.py | 1 + .../Source/Python/GenFds/RuleSimpleFile.py | 1 + BaseTools/Source/Python/GenFds/Section.py | 1 + BaseTools/Source/Python/GenFds/UiSection.py | 1 + BaseTools/Source/Python/GenFds/VerSection.py | 1 + BaseTools/Source/Python/GenFds/Vtf.py | 1 + .../GenPatchPcdTable/GenPatchPcdTable.py | 1 + .../Python/PatchPcdValue/PatchPcdValue.py | 2 +- .../Source/Python/Pkcs7Sign/Pkcs7Sign.py | 16 +- .../Rsa2048Sha256GenerateKeys.py | 18 +- .../Rsa2048Sha256Sign/Rsa2048Sha256Sign.py | 21 +- .../Source/Python/Table/TableDataModel.py | 1 + BaseTools/Source/Python/Table/TableDec.py | 1 + BaseTools/Source/Python/Table/TableDsc.py | 1 + .../Source/Python/Table/TableEotReport.py | 1 + BaseTools/Source/Python/Table/TableFdf.py | 1 + BaseTools/Source/Python/Table/TableFile.py | 1 + .../Source/Python/Table/TableFunction.py | 1 + .../Source/Python/Table/TableIdentifier.py | 1 + BaseTools/Source/Python/Table/TableInf.py | 1 + BaseTools/Source/Python/Table/TablePcd.py | 1 + BaseTools/Source/Python/Table/TableQuery.py | 1 + BaseTools/Source/Python/Table/TableReport.py | 1 + .../Source/Python/TargetTool/TargetTool.py | 1 + BaseTools/Source/Python/Trim/Trim.py | 15 +- BaseTools/Source/Python/UPT/Core/FileHook.py | 2 +- BaseTools/Source/Python/UPT/Core/IpiDb.py | 2 +- .../Python/UPT/GenMetaFile/GenDecFile.py | 18 +- .../Python/UPT/GenMetaFile/GenInfFile.py | 18 +- .../Python/UPT/Library/CommentGenerating.py | 40 +- .../Python/UPT/Library/CommentParsing.py | 9 +- .../Python/UPT/Library/ExpressionValidate.py | 1 + BaseTools/Source/Python/UPT/Library/Misc.py | 24 +- .../Python/UPT/Library/ParserValidate.py | 2 +- .../Source/Python/UPT/Library/Parsing.py | 3 +- .../Source/Python/UPT/Library/StringUtils.py | 17 +- .../Python/UPT/Library/UniClassObject.py | 21 +- .../Source/Python/UPT/Logger/StringTable.py | 2 +- BaseTools/Source/Python/UPT/MkPkg.py | 2 +- .../Source/Python/UPT/Parser/DecParser.py | 8 +- .../Source/Python/UPT/Parser/DecParserMisc.py | 4 +- .../Python/UPT/Parser/InfAsBuiltProcess.py | 2 +- .../Source/Python/UPT/Parser/InfParser.py | 4 +- .../Python/UPT/Parser/InfSectionParser.py | 6 +- .../Python/UPT/PomAdapter/DecPomAlignment.py | 1 + BaseTools/Source/Python/UPT/UPT.py | 4 + .../Python/UPT/UnitTest/DecParserTest.py | 1 + .../UPT/UnitTest/InfBinarySectionTest.py | 1 + BaseTools/Source/Python/UPT/Xml/IniToXml.py | 2 +- .../Source/Python/UPT/Xml/XmlParserMisc.py | 2 +- .../Python/Workspace/BuildClassObject.py | 4 +- .../Source/Python/Workspace/DscBuildData.py | 34 +- .../Source/Python/Workspace/InfBuildData.py | 1 + .../Source/Python/Workspace/MetaDataTable.py | 2 +- .../Source/Python/Workspace/MetaFileParser.py | 8 +- .../Source/Python/Workspace/MetaFileTable.py | 1 + .../Python/Workspace/WorkspaceCommon.py | 3 +- .../Python/Workspace/WorkspaceDatabase.py | 3 +- BaseTools/Source/Python/build/BuildReport.py | 112 +- BaseTools/Source/Python/build/build.py | 44 +- BaseTools/Tests/CheckUnicodeSourceFiles.py | 6 +- BaseTools/Tests/GNUmakefile | 2 +- BaseTools/Tests/TestTools.py | 14 +- BaseTools/toolsetup.bat | 32 +- edksetup.sh | 31 - 182 files changed, 46682 insertions(+), 13732 deletions(-) create mode 100644 BaseTools/Source/C/PyUtility/Makefile create mode 100644 BaseTools/Source/C/PyUtility/PyUtility.c create mode 100644 BaseTools/Source/C/PyUtility/setup.py create mode 100644 BaseTools/Source/Python/Common/PyUtility.pyd delete mode 100644 BaseTools/Source/Python/Ecc/C.g4 delete mode 100644 BaseTools/Source/Python/Ecc/CListener.py delete mode 100644 BaseTools/Source/Python/Eot/CListener.py rename BaseTools/Source/Python/Eot/{EotMain.py => Eot.py} (75%) diff --git a/BaseTools/Bin/CYGWIN_NT-5.1-i686/Ecc b/BaseTools/Bin/CYGWIN_NT-5.1-i686/Ecc index 0b173eb33c..214d88fff1 100755 --- a/BaseTools/Bin/CYGWIN_NT-5.1-i686/Ecc +++ b/BaseTools/Bin/CYGWIN_NT-5.1-i686/Ecc @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a $PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenDepex b/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenDepex index 0b173eb33c..214d88fff1 100755 --- a/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenDepex +++ b/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenDepex @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a $PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFds b/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFds index 0b173eb33c..214d88fff1 100755 --- a/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFds +++ b/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFds @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a $PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/Bin/CYGWIN_NT-5.1-i686/TargetTool b/BaseTools/Bin/CYGWIN_NT-5.1-i686/TargetTool index 0b173eb33c..214d88fff1 100755 --- a/BaseTools/Bin/CYGWIN_NT-5.1-i686/TargetTool +++ b/BaseTools/Bin/CYGWIN_NT-5.1-i686/TargetTool @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a $PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/Bin/CYGWIN_NT-5.1-i686/Trim b/BaseTools/Bin/CYGWIN_NT-5.1-i686/Trim index 736ff12f14..7cac4f7c4f 100755 --- a/BaseTools/Bin/CYGWIN_NT-5.1-i686/Trim +++ b/BaseTools/Bin/CYGWIN_NT-5.1-i686/Trim @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a $PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/Bin/CYGWIN_NT-5.1-i686/build b/BaseTools/Bin/CYGWIN_NT-5.1-i686/build index 0b173eb33c..214d88fff1 100755 --- a/BaseTools/Bin/CYGWIN_NT-5.1-i686/build +++ b/BaseTools/Bin/CYGWIN_NT-5.1-i686/build @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a $PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/BinWrappers/PosixLike/BPDG b/BaseTools/BinWrappers/PosixLike/BPDG index 99dcf99657..276c7ea207 100755 --- a/BaseTools/BinWrappers/PosixLike/BPDG +++ b/BaseTools/BinWrappers/PosixLike/BPDG @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/BinWrappers/PosixLike/Ecc b/BaseTools/BinWrappers/PosixLike/Ecc index 0032408fa1..1142964028 100755 --- a/BaseTools/BinWrappers/PosixLike/Ecc +++ b/BaseTools/BinWrappers/PosixLike/Ecc @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/BinWrappers/PosixLike/GenDepex b/BaseTools/BinWrappers/PosixLike/GenDepex index f1bd62d7bd..dad174788b 100755 --- a/BaseTools/BinWrappers/PosixLike/GenDepex +++ b/BaseTools/BinWrappers/PosixLike/GenDepex @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/BinWrappers/PosixLike/GenFds b/BaseTools/BinWrappers/PosixLike/GenFds index 99dcf99657..276c7ea207 100755 --- a/BaseTools/BinWrappers/PosixLike/GenFds +++ b/BaseTools/BinWrappers/PosixLike/GenFds @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable b/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable index 76effb6da0..01ae23ddeb 100755 --- a/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable +++ b/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/BinWrappers/PosixLike/GenerateCapsule b/BaseTools/BinWrappers/PosixLike/GenerateCapsule index 3a1bd4d4e9..59a6c8ba43 100755 --- a/BaseTools/BinWrappers/PosixLike/GenerateCapsule +++ b/BaseTools/BinWrappers/PosixLike/GenerateCapsule @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/BinWrappers/PosixLike/PatchPcdValue b/BaseTools/BinWrappers/PosixLike/PatchPcdValue index 76effb6da0..01ae23ddeb 100755 --- a/BaseTools/BinWrappers/PosixLike/PatchPcdValue +++ b/BaseTools/BinWrappers/PosixLike/PatchPcdValue @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/BinWrappers/PosixLike/Pkcs7Sign b/BaseTools/BinWrappers/PosixLike/Pkcs7Sign index 76effb6da0..01ae23ddeb 100755 --- a/BaseTools/BinWrappers/PosixLike/Pkcs7Sign +++ b/BaseTools/BinWrappers/PosixLike/Pkcs7Sign @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys b/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys index 0d7872d24d..1bc1054a34 100755 --- a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys +++ b/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign b/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign index 76effb6da0..01ae23ddeb 100755 --- a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign +++ b/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/BinWrappers/PosixLike/TargetTool b/BaseTools/BinWrappers/PosixLike/TargetTool index 76effb6da0..01ae23ddeb 100755 --- a/BaseTools/BinWrappers/PosixLike/TargetTool +++ b/BaseTools/BinWrappers/PosixLike/TargetTool @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/BinWrappers/PosixLike/Trim b/BaseTools/BinWrappers/PosixLike/Trim index f36bd69d26..6c8dde5bec 100755 --- a/BaseTools/BinWrappers/PosixLike/Trim +++ b/BaseTools/BinWrappers/PosixLike/Trim @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/BinWrappers/PosixLike/UPT b/BaseTools/BinWrappers/PosixLike/UPT index 76effb6da0..01ae23ddeb 100755 --- a/BaseTools/BinWrappers/PosixLike/UPT +++ b/BaseTools/BinWrappers/PosixLike/UPT @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/BinWrappers/PosixLike/build b/BaseTools/BinWrappers/PosixLike/build index 76effb6da0..01ae23ddeb 100755 --- a/BaseTools/BinWrappers/PosixLike/build +++ b/BaseTools/BinWrappers/PosixLike/build @@ -1,9 +1,9 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* -# If a PYTHON3 command is available, use it in preference to python -if command -v $PYTHON3 >/dev/null 2>&1; then - python_exe=$PYTHON3 +# If a python2 command is available, use it in preference to python +if command -v python2 >/dev/null 2>&1; then + python_exe=python2 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 diff --git a/BaseTools/BinWrappers/WindowsLike/BPDG.bat b/BaseTools/BinWrappers/WindowsLike/BPDG.bat index 8e2211e3c1..98095cfbd4 100644 --- a/BaseTools/BinWrappers/WindowsLike/BPDG.bat +++ b/BaseTools/BinWrappers/WindowsLike/BPDG.bat @@ -1,4 +1,4 @@ @setlocal @set ToolName=%~n0% @set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python -@%PYTHON3% -m %ToolName%.%ToolName% %* +@%PYTHON_HOME%\python.exe -m %ToolName%.%ToolName% %* diff --git a/BaseTools/BinWrappers/WindowsLike/Ecc.bat b/BaseTools/BinWrappers/WindowsLike/Ecc.bat index 151d9e730d..8705e7541e 100644 --- a/BaseTools/BinWrappers/WindowsLike/Ecc.bat +++ b/BaseTools/BinWrappers/WindowsLike/Ecc.bat @@ -1,4 +1,4 @@ @setlocal @set ToolName=%~n0% @set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python -@%PYTHON3% -m %ToolName%.EccMain %* +@%PYTHON_HOME%\python.exe -m %ToolName%.EccMain %* diff --git a/BaseTools/BinWrappers/WindowsLike/GenDepex.bat b/BaseTools/BinWrappers/WindowsLike/GenDepex.bat index e8e5753ce3..ffc783d2be 100644 --- a/BaseTools/BinWrappers/WindowsLike/GenDepex.bat +++ b/BaseTools/BinWrappers/WindowsLike/GenDepex.bat @@ -1,3 +1,3 @@ @setlocal @set ToolName=%~n0% -@%PYTHON3% %BASE_TOOLS_PATH%\Source\Python\AutoGen\%ToolName%.py %* +@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\AutoGen\%ToolName%.py %* diff --git a/BaseTools/BinWrappers/WindowsLike/GenFds.bat b/BaseTools/BinWrappers/WindowsLike/GenFds.bat index 8e2211e3c1..98095cfbd4 100644 --- a/BaseTools/BinWrappers/WindowsLike/GenFds.bat +++ b/BaseTools/BinWrappers/WindowsLike/GenFds.bat @@ -1,4 +1,4 @@ @setlocal @set ToolName=%~n0% @set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python -@%PYTHON3% -m %ToolName%.%ToolName% %* +@%PYTHON_HOME%\python.exe -m %ToolName%.%ToolName% %* diff --git a/BaseTools/BinWrappers/WindowsLike/GenPatchPcdTable.bat b/BaseTools/BinWrappers/WindowsLike/GenPatchPcdTable.bat index 160347c700..9fbb704a6e 100644 --- a/BaseTools/BinWrappers/WindowsLike/GenPatchPcdTable.bat +++ b/BaseTools/BinWrappers/WindowsLike/GenPatchPcdTable.bat @@ -1,3 +1,3 @@ @setlocal @set ToolName=%~n0% -@%PYTHON3% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* +@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* diff --git a/BaseTools/BinWrappers/WindowsLike/GenerateCapsule.bat b/BaseTools/BinWrappers/WindowsLike/GenerateCapsule.bat index a498b1efc5..ca442d181b 100644 --- a/BaseTools/BinWrappers/WindowsLike/GenerateCapsule.bat +++ b/BaseTools/BinWrappers/WindowsLike/GenerateCapsule.bat @@ -1 +1 @@ -@%PYTHON3% %BASE_TOOLS_PATH%\Source\Python\Capsule\GenerateCapsule.py %* +@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\Capsule\GenerateCapsule.py %* diff --git a/BaseTools/BinWrappers/WindowsLike/PatchPcdValue.bat b/BaseTools/BinWrappers/WindowsLike/PatchPcdValue.bat index 160347c700..9fbb704a6e 100644 --- a/BaseTools/BinWrappers/WindowsLike/PatchPcdValue.bat +++ b/BaseTools/BinWrappers/WindowsLike/PatchPcdValue.bat @@ -1,3 +1,3 @@ @setlocal @set ToolName=%~n0% -@%PYTHON3% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* +@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* diff --git a/BaseTools/BinWrappers/WindowsLike/Pkcs7Sign.bat b/BaseTools/BinWrappers/WindowsLike/Pkcs7Sign.bat index 160347c700..9fbb704a6e 100644 --- a/BaseTools/BinWrappers/WindowsLike/Pkcs7Sign.bat +++ b/BaseTools/BinWrappers/WindowsLike/Pkcs7Sign.bat @@ -1,3 +1,3 @@ @setlocal @set ToolName=%~n0% -@%PYTHON3% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* +@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* diff --git a/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat b/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat index c3323a742d..df9336567c 100644 --- a/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat +++ b/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat @@ -1 +1 @@ -@%PYTHON3% %BASE_TOOLS_PATH%\Source\Python\Rsa2048Sha256Sign\Rsa2048Sha256GenerateKeys.py %* +@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\Rsa2048Sha256Sign\Rsa2048Sha256GenerateKeys.py %* diff --git a/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256Sign.bat b/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256Sign.bat index 160347c700..9fbb704a6e 100644 --- a/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256Sign.bat +++ b/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256Sign.bat @@ -1,3 +1,3 @@ @setlocal @set ToolName=%~n0% -@%PYTHON3% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* +@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* diff --git a/BaseTools/BinWrappers/WindowsLike/TargetTool.bat b/BaseTools/BinWrappers/WindowsLike/TargetTool.bat index 160347c700..9fbb704a6e 100644 --- a/BaseTools/BinWrappers/WindowsLike/TargetTool.bat +++ b/BaseTools/BinWrappers/WindowsLike/TargetTool.bat @@ -1,3 +1,3 @@ @setlocal @set ToolName=%~n0% -@%PYTHON3% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* +@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* diff --git a/BaseTools/BinWrappers/WindowsLike/Trim.bat b/BaseTools/BinWrappers/WindowsLike/Trim.bat index 160347c700..9fbb704a6e 100644 --- a/BaseTools/BinWrappers/WindowsLike/Trim.bat +++ b/BaseTools/BinWrappers/WindowsLike/Trim.bat @@ -1,3 +1,3 @@ @setlocal @set ToolName=%~n0% -@%PYTHON3% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* +@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* diff --git a/BaseTools/BinWrappers/WindowsLike/UPT.bat b/BaseTools/BinWrappers/WindowsLike/UPT.bat index 160347c700..9fbb704a6e 100644 --- a/BaseTools/BinWrappers/WindowsLike/UPT.bat +++ b/BaseTools/BinWrappers/WindowsLike/UPT.bat @@ -1,3 +1,3 @@ @setlocal @set ToolName=%~n0% -@%PYTHON3% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* +@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* diff --git a/BaseTools/BinWrappers/WindowsLike/build.bat b/BaseTools/BinWrappers/WindowsLike/build.bat index 160347c700..9fbb704a6e 100644 --- a/BaseTools/BinWrappers/WindowsLike/build.bat +++ b/BaseTools/BinWrappers/WindowsLike/build.bat @@ -1,3 +1,3 @@ @setlocal @set ToolName=%~n0% -@%PYTHON3% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* +@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %* diff --git a/BaseTools/Makefile b/BaseTools/Makefile index 316f725bd9..b98cd85cb7 100644 --- a/BaseTools/Makefile +++ b/BaseTools/Makefile @@ -15,24 +15,24 @@ !ERROR "BASE_TOOLS_PATH is not set! Please run toolsetup.bat first!" !ENDIF -SUBDIRS = $(BASE_TOOLS_PATH)\Source\C +SUBDIRS = $(BASE_TOOLS_PATH)\Source\C $(BASE_TOOLS_PATH)\Source\Python -all: c +all: c python c : - @$(PYTHON3) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $(BASE_TOOLS_PATH)\Source\C + @$(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $(BASE_TOOLS_PATH)\Source\C python: - @$(PYTHON3) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $(BASE_TOOLS_PATH)\Source\Python + @$(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $(BASE_TOOLS_PATH)\Source\Python subdirs: $(SUBDIRS) - @$(PYTHON3) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $** + @$(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $** .PHONY: clean clean: - $(PYTHON3) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py clean $(SUBDIRS) + $(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py clean $(SUBDIRS) .PHONY: cleanall cleanall: - $(PYTHON3) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py cleanall $(SUBDIRS) + $(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py cleanall $(SUBDIRS) diff --git a/BaseTools/Scripts/PackageDocumentTools/Readme.md b/BaseTools/Scripts/PackageDocumentTools/Readme.md index f8f81e35ab..dfc2892c41 100644 --- a/BaseTools/Scripts/PackageDocumentTools/Readme.md +++ b/BaseTools/Scripts/PackageDocumentTools/Readme.md @@ -1,6 +1,6 @@ Prerequisite Tools: -1. Install Python 3.6.6 from https://www.python.org/downloads/release/python-366/ -2. Install wxPython 4.0.3 from https://pypi.org/project/wxPython/#files +1. Install Python 2.7.3 from https://www.python.org/download/releases/2.7.3/ +2. Install wxPython 2.8.12.1 from https://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/ generally the libraries will be installed at python's subfolder, for example in windows: c:\python27\Lib\site-packages\ 3. Install DoxyGen 1.8.6 from https://sourceforge.net/projects/doxygen/files/rel-1.8.6/ 4. (Windows only) Install Htmlhelp tool from https://msdn.microsoft.com/en-us/library/windows/desktop/ms669985(v=vs.85).aspx diff --git a/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py b/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py index 94c004902f..4deeee01a5 100644 --- a/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py +++ b/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py @@ -12,11 +12,12 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # +from __future__ import print_function import os, sys, logging, traceback, subprocess from optparse import OptionParser -from .plugins.EdkPlugins.edk2.model import baseobject -from .plugins.EdkPlugins.edk2.model import doxygengen +import plugins.EdkPlugins.edk2.model.baseobject as baseobject +import plugins.EdkPlugins.edk2.model.doxygengen as doxygengen gArchMarcoDict = {'ALL' : 'MDE_CPU_IA32 MDE_CPU_X64 MDE_CPU_EBC MDE_CPU_IPF _MSC_EXTENSIONS __GNUC__ __INTEL_COMPILER', 'IA32_MSFT': 'MDE_CPU_IA32 _MSC_EXTENSIONS', @@ -37,7 +38,7 @@ def parseCmdArgs(): help='Specify the absolute path of doxygen tools installation. For example: C:\\Program Files\\doxygen\bin\doxygen.exe') parser.add_option('-o', '--output', action='store', dest='OutputPath', help='Specify the document output path. For example: c:\\docoutput') - parser.add_option('-a', '--arch', action='store', dest='Arch', choices=list(gArchMarcoDict.keys()), + parser.add_option('-a', '--arch', action='store', dest='Arch', choices=gArchMarcoDict.keys(), help='Specify the architecture used in preprocess package\'s source. For example: -a IA32_MSFT') parser.add_option('-m', '--mode', action='store', dest='DocumentMode', choices=['CHM', 'HTML'], help='Specify the document mode from : CHM or HTML') diff --git a/BaseTools/Scripts/PackageDocumentTools/packagedocapp.pyw b/BaseTools/Scripts/PackageDocumentTools/packagedocapp.pyw index f81ecfdc4c..28f6f9bf5c 100644 --- a/BaseTools/Scripts/PackageDocumentTools/packagedocapp.pyw +++ b/BaseTools/Scripts/PackageDocumentTools/packagedocapp.pyw @@ -18,8 +18,8 @@ import os, sys, wx, logging import wx.stc import wx.lib.newevent import wx.lib.agw.genericmessagedialog as GMD -from plugins.EdkPlugins.edk2.model import baseobject -from plugins.EdkPlugins.edk2.model import doxygengen +import plugins.EdkPlugins.edk2.model.baseobject as baseobject +import plugins.EdkPlugins.edk2.model.doxygengen as doxygengen if hasattr(sys, "frozen"): appPath = os.path.abspath(os.path.dirname(sys.executable)) @@ -42,7 +42,7 @@ class PackageDocApp(wx.App): frame.Show(True) - self.Bind(EVT_APP_CALLBACK, self.OnAppCallBack) + EVT_APP_CALLBACK( self, self.OnAppCallBack) return True def GetLogger(self): @@ -60,13 +60,13 @@ class PackageDocApp(wx.App): class PackageDocMainFrame(wx.Frame): def __init__(self, parent, title): - wx.Frame.__init__(self, parent, -1, title, size=(550, 350), style=wx.MINIMIZE_BOX|wx.SYSTEM_MENU|wx.CAPTION|wx.CLOSE_BOX ) + wx.Frame.__init__(self, parent, -1, title, size=(550, 290), style=wx.MINIMIZE_BOX|wx.SYSTEM_MENU|wx.CAPTION|wx.CLOSE_BOX ) panel = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) subsizer = wx.GridBagSizer(5, 10) - subsizer.AddGrowableCol(0) + subsizer.AddGrowableCol(1) subsizer.Add(wx.StaticText(panel, -1, "Workspace Location : "), (0, 0), flag=wx.ALIGN_CENTER_VERTICAL) self._workspacePathCtrl = wx.ComboBox(panel, -1) list = self.GetConfigure("WorkspacePath") @@ -76,9 +76,9 @@ class PackageDocMainFrame(wx.Frame): self._workspacePathCtrl.SetValue(list[len(list) - 1]) subsizer.Add(self._workspacePathCtrl, (0, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) - self._workspacePathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN)) + self._workspacePathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN)) subsizer.Add(self._workspacePathBt, (0, 2), flag=wx.ALIGN_CENTER_VERTICAL) - self.Bind(wx.EVT_BUTTON, self.OnBrowsePath, self._workspacePathBt) + wx.EVT_BUTTON(self._workspacePathBt, self._workspacePathBt.GetId(), self.OnBrowsePath) subsizer.Add(wx.StaticText(panel, -1, "Package DEC Location : "), (1, 0), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) self._packagePathCtrl = wx.ComboBox(panel, -1) @@ -88,9 +88,9 @@ class PackageDocMainFrame(wx.Frame): self._packagePathCtrl.Append(item) self._packagePathCtrl.SetValue(list[len(list) - 1]) subsizer.Add(self._packagePathCtrl, (1, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) - self._packagePathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN)) + self._packagePathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN)) subsizer.Add(self._packagePathBt, (1, 2), flag=wx.ALIGN_CENTER_VERTICAL) - self.Bind(wx.EVT_BUTTON, self.OnBrowsePath, self._packagePathBt) + wx.EVT_BUTTON(self._packagePathBt, self._packagePathBt.GetId(), self.OnBrowsePath) subsizer.Add(wx.StaticText(panel, -1, "Doxygen Tool Location : "), (2, 0), flag=wx.ALIGN_CENTER_VERTICAL) self._doxygenPathCtrl = wx.TextCtrl(panel, -1) @@ -103,10 +103,10 @@ class PackageDocMainFrame(wx.Frame): else: self._doxygenPathCtrl.SetValue('/usr/bin/doxygen') - self._doxygenPathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN)) + self._doxygenPathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN)) subsizer.Add(self._doxygenPathCtrl, (2, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) subsizer.Add(self._doxygenPathBt, (2, 2), flag=wx.ALIGN_CENTER_VERTICAL) - self.Bind(wx.EVT_BUTTON, self.OnBrowsePath, self._doxygenPathBt) + wx.EVT_BUTTON(self._doxygenPathBt, self._doxygenPathBt.GetId(), self.OnBrowsePath) subsizer.Add(wx.StaticText(panel, -1, "CHM Tool Location : "), (3, 0), flag=wx.ALIGN_CENTER_VERTICAL) self._chmPathCtrl = wx.TextCtrl(panel, -1) @@ -116,10 +116,10 @@ class PackageDocMainFrame(wx.Frame): else: self._chmPathCtrl.SetValue('C:\\Program Files\\HTML Help Workshop\\hhc.exe') - self._chmPathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN)) + self._chmPathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN)) subsizer.Add(self._chmPathCtrl, (3, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) subsizer.Add(self._chmPathBt, (3, 2), flag=wx.ALIGN_CENTER_VERTICAL) - self.Bind(wx.EVT_BUTTON, self.OnBrowsePath, self._chmPathBt) + wx.EVT_BUTTON(self._chmPathBt, self._chmPathBt.GetId(), self.OnBrowsePath) subsizer.Add(wx.StaticText(panel, -1, "Output Location : "), (4, 0), flag=wx.ALIGN_CENTER_VERTICAL) self._outputPathCtrl = wx.ComboBox(panel, -1) @@ -130,9 +130,9 @@ class PackageDocMainFrame(wx.Frame): self._outputPathCtrl.SetValue(list[len(list) - 1]) subsizer.Add(self._outputPathCtrl, (4, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) - self._outputPathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN)) + self._outputPathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN)) subsizer.Add(self._outputPathBt, (4, 2), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) - self.Bind(wx.EVT_BUTTON, self.OnBrowsePath, self._outputPathBt) + wx.EVT_BUTTON(self._outputPathBt, self._outputPathBt.GetId(), self.OnBrowsePath) subsizer.Add(wx.StaticText(panel, -1, "Architecture Specified : "), (5, 0), flag=wx.ALIGN_CENTER_VERTICAL) self._archCtrl = wx.ComboBox(panel, -1, value='ALL', choices=['ALL', 'IA32/MSFT', 'IA32/GNU', 'X64/INTEL', 'X64/GNU', 'IPF/MSFT', 'IPF/GNU', 'EBC/INTEL'], @@ -164,7 +164,7 @@ class PackageDocMainFrame(wx.Frame): def SaveConfigure(self, name, value): if value ==None or len(value) == 0: return - config = wx.ConfigBase.Get() + config = wx.ConfigBase_Get() oldvalues = config.Read(name, '').split(';') if len(oldvalues) >= 10: oldvalues.remove(oldvalues[0]) @@ -177,7 +177,7 @@ class PackageDocMainFrame(wx.Frame): config.Write(name, ';'.join(oldvalues)) def GetConfigure(self, name): - config = wx.ConfigBase.Get() + config = wx.ConfigBase_Get() values = config.Read(name, '').split(';') list = [] for item in values: @@ -416,10 +416,10 @@ class ProgressDialog(wx.Dialog): logging.getLogger('').addHandler(self._loghandle) logging.getLogger('app').addHandler(self._loghandle) - self.Bind(wx.EVT_BUTTON, self.OnButtonClose, self._closeBt) - self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateCloseButton) - self.Bind(wx.EVT_BUTTON, self.OnGotoOutput, self._gotoOuputBt) - self.Bind(EVT_LOG, self.OnPostLog) + wx.EVT_BUTTON(self._closeBt, self._closeBt.GetId(), self.OnButtonClose) + wx.EVT_UPDATE_UI(self, self._closeBt.GetId(), self.OnUpdateCloseButton) + wx.EVT_BUTTON(self._gotoOuputBt, self._gotoOuputBt.GetId(), self.OnGotoOutput) + EVT_LOG(self, self.OnPostLog) self._process = None self._pid = None @@ -720,7 +720,7 @@ class ProgressDialog(wx.Dialog): lines = f.readlines() f.close() bfound = False - for index in range(len(lines)): + for index in xrange(len(lines)): if lines[index].find('File List') != -1: lines[index] = "