From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 25DEA203369C2 for ; Thu, 5 Jul 2018 17:46:21 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jul 2018 17:46:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,314,1526367600"; d="scan'208";a="72614742" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga002.jf.intel.com with ESMTP; 05 Jul 2018 17:46:14 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 5 Jul 2018 17:46:13 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 5 Jul 2018 17:46:13 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.100]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.81]) with mapi id 14.03.0319.002; Fri, 6 Jul 2018 08:46:11 +0800 From: "Zhu, Yonghong" To: Gary Lin , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH 3/3] BaseTools: Read the env variable PYTHON_DEFAULT Thread-Index: AQHUDf7Y9Vq/HKU1pkukxVcbItVHJaSBZ8nw Date: Fri, 6 Jul 2018 00:46:10 +0000 Message-ID: References: <20180627100757.3405-1-glin@suse.com> <20180627100757.3405-4-glin@suse.com> In-Reply-To: <20180627100757.3405-4-glin@suse.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTcxOGM5ZGYtZDQwMC00MzJjLTliYTUtMzc1MzFkMzY5OTFlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiQURuZFQ1RlwvQWoyK3pta1hiV1pZM2d6OTlDaGZMUmNEZGhrZEhPTWowNWNaUmg1NCtKV2xvM0pVTWM4eThZREYifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 3/3] BaseTools: Read the env variable PYTHON_DEFAULT X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jul 2018 00:46:22 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Gary, The patch 1 and patch 2 are good to me.=20 While for this patch 3, I think it is only for developer evaluation, develo= per can keep it on his local, so I don't prefer to commit it to master. =20 I have a task on my plan to migrate BaseTools to Python 3, maybe this Q3 t= o finish it. Best Regards, Zhu Yonghong -----Original Message----- From: Gary Lin [mailto:glin@suse.com]=20 Sent: Wednesday, June 27, 2018 6:08 PM To: edk2-devel@lists.01.org Cc: Zhu, Yonghong ; Gao, Liming Subject: [PATCH 3/3] BaseTools: Read the env variable PYTHON_DEFAULT When PYTHON_DEFAULT is set as "python3", the bash scripts in PosixLike will= perfer python3. Currently, this is for the evaluation of the python3 suppo= rt and errors from the python3 interperter are expected. For example, to build OvmfPkg with python3: $ export PYTHON_DEFAULT=3Dpython3 $ ./OvmfPkg/build.sh Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/BinWrappers/PosixLike/BPDG | 6 +++++- BaseTools/BinWrappers/PosixLike/Ecc | 6 +++++- BaseTools/BinWrappers/PosixLike/GenDepex | 6 +++++- BaseTools/BinWrappers/PosixLike/GenFds | 6 +++++- BaseTools/BinWrappers/PosixLike/GenPatchPcdTable | 6 +++++- BaseTools/BinWrappers/PosixLike/PatchPcdValue | 6 +++++- BaseTools/BinWrappers/PosixLike/Pkcs7Sign | 6 +++++- BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys | 6 +++++- BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign | 6 +++++- BaseTools/BinWrappers/PosixLike/TargetTool | 6 +++++- BaseTools/BinWrappers/PosixLike/Trim | 6 +++++- BaseTools/BinWrappers/PosixLike/UPT | 6 +++++- BaseTools/BinWrappers/PosixLike/build | 6 +++++- 13 files changed, 65 insertions(+), 13 deletions(-) diff --git a/BaseTools/BinWrappers/PosixLike/BPDG b/BaseTools/BinWrappers/P= osixLike/BPDG index 01ae23ddeb4f..aef1bc444a64 100755 --- a/BaseTools/BinWrappers/PosixLike/BPDG +++ b/BaseTools/BinWrappers/PosixLike/BPDG @@ -1,8 +1,12 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* =20 +# If a python3 command is available and PYTHON_DEFAULT is "python3", #=20 +use it in preference to python if test "$PYTHON_DEFAULT" =3D=3D "python3"= =20 +&& command -v python3 >/dev/null 2>&1; then + python_exe=3Dpython3 # If a python2 command is available, use it in preference to python -if co= mmand -v python2 >/dev/null 2>&1; then +elif command -v python2 >/dev/null 2>&1; then python_exe=3Dpython2 fi =20 diff --git a/BaseTools/BinWrappers/PosixLike/Ecc b/BaseTools/BinWrappers/Po= sixLike/Ecc index 01ae23ddeb4f..aef1bc444a64 100755 --- a/BaseTools/BinWrappers/PosixLike/Ecc +++ b/BaseTools/BinWrappers/PosixLike/Ecc @@ -1,8 +1,12 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* =20 +# If a python3 command is available and PYTHON_DEFAULT is "python3", #=20 +use it in preference to python if test "$PYTHON_DEFAULT" =3D=3D "python3"= =20 +&& command -v python3 >/dev/null 2>&1; then + python_exe=3Dpython3 # If a python2 command is available, use it in preference to python -if co= mmand -v python2 >/dev/null 2>&1; then +elif command -v python2 >/dev/null 2>&1; then python_exe=3Dpython2 fi =20 diff --git a/BaseTools/BinWrappers/PosixLike/GenDepex b/BaseTools/BinWrappe= rs/PosixLike/GenDepex index dad174788bc3..c311d76238e4 100755 --- a/BaseTools/BinWrappers/PosixLike/GenDepex +++ b/BaseTools/BinWrappers/PosixLike/GenDepex @@ -1,8 +1,12 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* =20 +# If a python3 command is available and PYTHON_DEFAULT is "python3", #=20 +use it in preference to python if test "$PYTHON_DEFAULT" =3D=3D "python3"= =20 +&& command -v python3 >/dev/null 2>&1; then + python_exe=3Dpython3 # If a python2 command is available, use it in preference to python -if co= mmand -v python2 >/dev/null 2>&1; then +elif command -v python2 >/dev/null 2>&1; then python_exe=3Dpython2 fi =20 diff --git a/BaseTools/BinWrappers/PosixLike/GenFds b/BaseTools/BinWrappers= /PosixLike/GenFds index 01ae23ddeb4f..aef1bc444a64 100755 --- a/BaseTools/BinWrappers/PosixLike/GenFds +++ b/BaseTools/BinWrappers/PosixLike/GenFds @@ -1,8 +1,12 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* =20 +# If a python3 command is available and PYTHON_DEFAULT is "python3", #=20 +use it in preference to python if test "$PYTHON_DEFAULT" =3D=3D "python3"= =20 +&& command -v python3 >/dev/null 2>&1; then + python_exe=3Dpython3 # If a python2 command is available, use it in preference to python -if co= mmand -v python2 >/dev/null 2>&1; then +elif command -v python2 >/dev/null 2>&1; then python_exe=3Dpython2 fi =20 diff --git a/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable b/BaseTools/B= inWrappers/PosixLike/GenPatchPcdTable index 01ae23ddeb4f..aef1bc444a64 100755 --- a/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable +++ b/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable @@ -1,8 +1,12 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* =20 +# If a python3 command is available and PYTHON_DEFAULT is "python3", #=20 +use it in preference to python if test "$PYTHON_DEFAULT" =3D=3D "python3"= =20 +&& command -v python3 >/dev/null 2>&1; then + python_exe=3Dpython3 # If a python2 command is available, use it in preference to python -if co= mmand -v python2 >/dev/null 2>&1; then +elif command -v python2 >/dev/null 2>&1; then python_exe=3Dpython2 fi =20 diff --git a/BaseTools/BinWrappers/PosixLike/PatchPcdValue b/BaseTools/BinW= rappers/PosixLike/PatchPcdValue index 01ae23ddeb4f..aef1bc444a64 100755 --- a/BaseTools/BinWrappers/PosixLike/PatchPcdValue +++ b/BaseTools/BinWrappers/PosixLike/PatchPcdValue @@ -1,8 +1,12 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* =20 +# If a python3 command is available and PYTHON_DEFAULT is "python3", #=20 +use it in preference to python if test "$PYTHON_DEFAULT" =3D=3D "python3"= =20 +&& command -v python3 >/dev/null 2>&1; then + python_exe=3Dpython3 # If a python2 command is available, use it in preference to python -if co= mmand -v python2 >/dev/null 2>&1; then +elif command -v python2 >/dev/null 2>&1; then python_exe=3Dpython2 fi =20 diff --git a/BaseTools/BinWrappers/PosixLike/Pkcs7Sign b/BaseTools/BinWrapp= ers/PosixLike/Pkcs7Sign index 01ae23ddeb4f..aef1bc444a64 100755 --- a/BaseTools/BinWrappers/PosixLike/Pkcs7Sign +++ b/BaseTools/BinWrappers/PosixLike/Pkcs7Sign @@ -1,8 +1,12 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* =20 +# If a python3 command is available and PYTHON_DEFAULT is "python3", #=20 +use it in preference to python if test "$PYTHON_DEFAULT" =3D=3D "python3"= =20 +&& command -v python3 >/dev/null 2>&1; then + python_exe=3Dpython3 # If a python2 command is available, use it in preference to python -if co= mmand -v python2 >/dev/null 2>&1; then +elif command -v python2 >/dev/null 2>&1; then python_exe=3Dpython2 fi =20 diff --git a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys b/Ba= seTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys index 1bc1054a3452..d6f3d0e23083 100755 --- a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys +++ b/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys @@ -1,8 +1,12 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* =20 +# If a python3 command is available and PYTHON_DEFAULT is "python3", #=20 +use it in preference to python if test "$PYTHON_DEFAULT" =3D=3D "python3"= =20 +&& command -v python3 >/dev/null 2>&1; then + python_exe=3Dpython3 # If a python2 command is available, use it in preference to python -if co= mmand -v python2 >/dev/null 2>&1; then +elif command -v python2 >/dev/null 2>&1; then python_exe=3Dpython2 fi =20 diff --git a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign b/BaseTools/= BinWrappers/PosixLike/Rsa2048Sha256Sign index 01ae23ddeb4f..aef1bc444a64 100755 --- a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign +++ b/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign @@ -1,8 +1,12 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* =20 +# If a python3 command is available and PYTHON_DEFAULT is "python3", #=20 +use it in preference to python if test "$PYTHON_DEFAULT" =3D=3D "python3"= =20 +&& command -v python3 >/dev/null 2>&1; then + python_exe=3Dpython3 # If a python2 command is available, use it in preference to python -if co= mmand -v python2 >/dev/null 2>&1; then +elif command -v python2 >/dev/null 2>&1; then python_exe=3Dpython2 fi =20 diff --git a/BaseTools/BinWrappers/PosixLike/TargetTool b/BaseTools/BinWrap= pers/PosixLike/TargetTool index 01ae23ddeb4f..aef1bc444a64 100755 --- a/BaseTools/BinWrappers/PosixLike/TargetTool +++ b/BaseTools/BinWrappers/PosixLike/TargetTool @@ -1,8 +1,12 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* =20 +# If a python3 command is available and PYTHON_DEFAULT is "python3", #=20 +use it in preference to python if test "$PYTHON_DEFAULT" =3D=3D "python3"= =20 +&& command -v python3 >/dev/null 2>&1; then + python_exe=3Dpython3 # If a python2 command is available, use it in preference to python -if co= mmand -v python2 >/dev/null 2>&1; then +elif command -v python2 >/dev/null 2>&1; then python_exe=3Dpython2 fi =20 diff --git a/BaseTools/BinWrappers/PosixLike/Trim b/BaseTools/BinWrappers/P= osixLike/Trim index 6c8dde5bec3e..6ec76c3a45c9 100755 --- a/BaseTools/BinWrappers/PosixLike/Trim +++ b/BaseTools/BinWrappers/PosixLike/Trim @@ -1,8 +1,12 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* =20 +# If a python3 command is available and PYTHON_DEFAULT is "python3", #=20 +use it in preference to python if test "$PYTHON_DEFAULT" =3D=3D "python3"= =20 +&& command -v python3 >/dev/null 2>&1; then + python_exe=3Dpython3 # If a python2 command is available, use it in preference to python -if co= mmand -v python2 >/dev/null 2>&1; then +elif command -v python2 >/dev/null 2>&1; then python_exe=3Dpython2 fi =20 diff --git a/BaseTools/BinWrappers/PosixLike/UPT b/BaseTools/BinWrappers/Po= sixLike/UPT index 01ae23ddeb4f..aef1bc444a64 100755 --- a/BaseTools/BinWrappers/PosixLike/UPT +++ b/BaseTools/BinWrappers/PosixLike/UPT @@ -1,8 +1,12 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* =20 +# If a python3 command is available and PYTHON_DEFAULT is "python3", #=20 +use it in preference to python if test "$PYTHON_DEFAULT" =3D=3D "python3"= =20 +&& command -v python3 >/dev/null 2>&1; then + python_exe=3Dpython3 # If a python2 command is available, use it in preference to python -if co= mmand -v python2 >/dev/null 2>&1; then +elif command -v python2 >/dev/null 2>&1; then python_exe=3Dpython2 fi =20 diff --git a/BaseTools/BinWrappers/PosixLike/build b/BaseTools/BinWrappers/= PosixLike/build index 01ae23ddeb4f..aef1bc444a64 100755 --- a/BaseTools/BinWrappers/PosixLike/build +++ b/BaseTools/BinWrappers/PosixLike/build @@ -1,8 +1,12 @@ #!/usr/bin/env bash #python `dirname $0`/RunToolFromSource.py `basename $0` $* =20 +# If a python3 command is available and PYTHON_DEFAULT is "python3", #=20 +use it in preference to python if test "$PYTHON_DEFAULT" =3D=3D "python3"= =20 +&& command -v python3 >/dev/null 2>&1; then + python_exe=3Dpython3 # If a python2 command is available, use it in preference to python -if co= mmand -v python2 >/dev/null 2>&1; then +elif command -v python2 >/dev/null 2>&1; then python_exe=3Dpython2 fi =20 -- 2.17.1