From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (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 062C72096F32D for ; Thu, 5 Jul 2018 18:49:18 -0700 (PDT) Received: from emea4-mta.ukb.novell.com ([10.120.13.87]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Fri, 06 Jul 2018 03:49:16 +0200 Received: from GaryWorkstation (nwb-a10-snat.microfocus.com [10.120.13.202]) by emea4-mta.ukb.novell.com with ESMTP (TLS encrypted); Fri, 06 Jul 2018 02:49:08 +0100 Date: Fri, 6 Jul 2018 09:49:02 +0800 From: Gary Lin To: "Zhu, Yonghong" Cc: "edk2-devel@lists.01.org" , "Gao, Liming" Message-ID: <20180706014902.qq4e4siohwpwgl6m@GaryWorkstation> References: <20180627100757.3405-1-glin@suse.com> <20180627100757.3405-4-glin@suse.com> MIME-Version: 1.0 In-Reply-To: User-Agent: NeoMutt/20170912 (1.9.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 01:49:19 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Jul 06, 2018 at 12:46:10AM +0000, Zhu, Yonghong wrote: > Hi Gary, > > The patch 1 and patch 2 are good to me. > While for this patch 3, I think it is only for developer evaluation, developer can keep it on his local, so I don't prefer to commit it to master. > I have a task on my plan to migrate BaseTools to Python 3, maybe this Q3 to finish it. > Fair enough. I will keep the patch in my own branch and rebase it when necessary. I have another patch set to adopt the absolute import and will send them later. Hope this can help you for the python3 migration:) Thanks, Gary Lin > Best Regards, > Zhu Yonghong > > > -----Original Message----- > From: Gary Lin [mailto:glin@suse.com] > 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 support and errors from the python3 interperter are expected. > > For example, to build OvmfPkg with python3: > > $ export PYTHON_DEFAULT=python3 > $ ./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/PosixLike/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` $* > > +# If a python3 command is available and PYTHON_DEFAULT is "python3", # > +use it in preference to python if test "$PYTHON_DEFAULT" == "python3" > +&& 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 > +elif command -v python2 >/dev/null 2>&1; then > python_exe=python2 > fi > > diff --git a/BaseTools/BinWrappers/PosixLike/Ecc b/BaseTools/BinWrappers/PosixLike/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` $* > > +# If a python3 command is available and PYTHON_DEFAULT is "python3", # > +use it in preference to python if test "$PYTHON_DEFAULT" == "python3" > +&& 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 > +elif command -v python2 >/dev/null 2>&1; then > python_exe=python2 > fi > > diff --git a/BaseTools/BinWrappers/PosixLike/GenDepex b/BaseTools/BinWrappers/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` $* > > +# If a python3 command is available and PYTHON_DEFAULT is "python3", # > +use it in preference to python if test "$PYTHON_DEFAULT" == "python3" > +&& 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 > +elif command -v python2 >/dev/null 2>&1; then > python_exe=python2 > fi > > 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` $* > > +# If a python3 command is available and PYTHON_DEFAULT is "python3", # > +use it in preference to python if test "$PYTHON_DEFAULT" == "python3" > +&& 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 > +elif command -v python2 >/dev/null 2>&1; then > python_exe=python2 > fi > > diff --git a/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable b/BaseTools/BinWrappers/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` $* > > +# If a python3 command is available and PYTHON_DEFAULT is "python3", # > +use it in preference to python if test "$PYTHON_DEFAULT" == "python3" > +&& 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 > +elif command -v python2 >/dev/null 2>&1; then > python_exe=python2 > fi > > diff --git a/BaseTools/BinWrappers/PosixLike/PatchPcdValue b/BaseTools/BinWrappers/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` $* > > +# If a python3 command is available and PYTHON_DEFAULT is "python3", # > +use it in preference to python if test "$PYTHON_DEFAULT" == "python3" > +&& 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 > +elif command -v python2 >/dev/null 2>&1; then > python_exe=python2 > fi > > diff --git a/BaseTools/BinWrappers/PosixLike/Pkcs7Sign b/BaseTools/BinWrappers/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` $* > > +# If a python3 command is available and PYTHON_DEFAULT is "python3", # > +use it in preference to python if test "$PYTHON_DEFAULT" == "python3" > +&& 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 > +elif command -v python2 >/dev/null 2>&1; then > python_exe=python2 > fi > > diff --git a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys b/BaseTools/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` $* > > +# If a python3 command is available and PYTHON_DEFAULT is "python3", # > +use it in preference to python if test "$PYTHON_DEFAULT" == "python3" > +&& 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 > +elif command -v python2 >/dev/null 2>&1; then > python_exe=python2 > fi > > 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` $* > > +# If a python3 command is available and PYTHON_DEFAULT is "python3", # > +use it in preference to python if test "$PYTHON_DEFAULT" == "python3" > +&& 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 > +elif command -v python2 >/dev/null 2>&1; then > python_exe=python2 > fi > > diff --git a/BaseTools/BinWrappers/PosixLike/TargetTool b/BaseTools/BinWrappers/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` $* > > +# If a python3 command is available and PYTHON_DEFAULT is "python3", # > +use it in preference to python if test "$PYTHON_DEFAULT" == "python3" > +&& 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 > +elif command -v python2 >/dev/null 2>&1; then > python_exe=python2 > fi > > diff --git a/BaseTools/BinWrappers/PosixLike/Trim b/BaseTools/BinWrappers/PosixLike/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` $* > > +# If a python3 command is available and PYTHON_DEFAULT is "python3", # > +use it in preference to python if test "$PYTHON_DEFAULT" == "python3" > +&& 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 > +elif command -v python2 >/dev/null 2>&1; then > python_exe=python2 > fi > > diff --git a/BaseTools/BinWrappers/PosixLike/UPT b/BaseTools/BinWrappers/PosixLike/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` $* > > +# If a python3 command is available and PYTHON_DEFAULT is "python3", # > +use it in preference to python if test "$PYTHON_DEFAULT" == "python3" > +&& 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 > +elif command -v python2 >/dev/null 2>&1; then > python_exe=python2 > fi > > 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` $* > > +# If a python3 command is available and PYTHON_DEFAULT is "python3", # > +use it in preference to python if test "$PYTHON_DEFAULT" == "python3" > +&& 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 > +elif command -v python2 >/dev/null 2>&1; then > python_exe=python2 > fi > > -- > 2.17.1 > >