From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 70131225E964B for ; Tue, 20 Mar 2018 19:16:10 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Mar 2018 19:22:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,338,1517904000"; d="scan'208";a="26684050" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga007.jf.intel.com with ESMTP; 20 Mar 2018 19:22:40 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 20 Mar 2018 19:22:40 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 20 Mar 2018 19:22:40 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.226]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.166]) with mapi id 14.03.0319.002; Wed, 21 Mar 2018 10:22:38 +0800 From: "Gao, Liming" To: Laszlo Ersek , edk2-devel-01 Thread-Topic: [PATCH] BaseTools/PosixLike: honor pre-set PYTHONPATH Thread-Index: AQHTu4LVV6StpZzuXUS4nA/OF1OljaPZ/9Mw Date: Wed, 21 Mar 2018 02:22:37 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E1EA9BC@SHSMSX104.ccr.corp.intel.com> References: <20180314105423.27682-1-lersek@redhat.com> In-Reply-To: <20180314105423.27682-1-lersek@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] BaseTools/PosixLike: honor pre-set PYTHONPATH X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 02:16:11 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable The change is good.=20 Reviewed-by: Liming Gao > -----Original Message----- > From: Laszlo Ersek [mailto:lersek@redhat.com] > Sent: Wednesday, March 14, 2018 6:54 PM > To: edk2-devel-01 > Cc: Gao, Liming ; Zhu, Yonghong > Subject: [PATCH] BaseTools/PosixLike: honor pre-set PYTHONPATH >=20 > Utilities written in Python may depend on external (preinstalled) Python > packages; for example, Ecc depends on "antlr_python_runtime-3.0.1". Such > packages need not be installed system-wide, as long as they are reachable > through PYTHONPATH. Therefore we shouldn't overwrite the user's PYTHONPAT= H > with "BaseTools/Source/Python"; instead, we should prepend the latter to > the former. >=20 > Cc: Liming Gao > Cc: Yonghong Zhu > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D896 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Laszlo Ersek > --- >=20 > Notes: > Repo: https://github.com/lersek/edk2.git > Branch: pythonpath >=20 > BaseTools/BinWrappers/PosixLike/BPDG | 2 +- > BaseTools/BinWrappers/PosixLike/Ecc | 2 +- > BaseTools/BinWrappers/PosixLike/GenDepex | 2 +- > BaseTools/BinWrappers/PosixLike/GenFds | 2 +- > BaseTools/BinWrappers/PosixLike/GenPatchPcdTable | 2 +- > BaseTools/BinWrappers/PosixLike/PatchPcdValue | 2 +- > BaseTools/BinWrappers/PosixLike/Pkcs7Sign | 2 +- > BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys | 2 +- > BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign | 2 +- > BaseTools/BinWrappers/PosixLike/TargetTool | 2 +- > BaseTools/BinWrappers/PosixLike/Trim | 2 +- > BaseTools/BinWrappers/PosixLike/UPT | 2 +- > BaseTools/BinWrappers/PosixLike/build | 2 +- > 13 files changed, 13 insertions(+), 13 deletions(-) >=20 > diff --git a/BaseTools/BinWrappers/PosixLike/BPDG b/BaseTools/BinWrappers= /PosixLike/BPDG > index 214d88fff1b1..01ae23ddeb4f 100755 > --- a/BaseTools/BinWrappers/PosixLike/BPDG > +++ b/BaseTools/BinWrappers/PosixLike/BPDG > @@ -10,5 +10,5 @@ full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.woole= dge.org/BashFAQ/028 for a d > dir=3D$(dirname "$full_cmd") > cmd=3D${full_cmd##*/} >=20 > -export PYTHONPATH=3D"$dir/../../Source/Python" > +export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH= "}" > exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@= " > diff --git a/BaseTools/BinWrappers/PosixLike/Ecc b/BaseTools/BinWrappers/= PosixLike/Ecc > index 214d88fff1b1..01ae23ddeb4f 100755 > --- a/BaseTools/BinWrappers/PosixLike/Ecc > +++ b/BaseTools/BinWrappers/PosixLike/Ecc > @@ -10,5 +10,5 @@ full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.woole= dge.org/BashFAQ/028 for a d > dir=3D$(dirname "$full_cmd") > cmd=3D${full_cmd##*/} >=20 > -export PYTHONPATH=3D"$dir/../../Source/Python" > +export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH= "}" > exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@= " > diff --git a/BaseTools/BinWrappers/PosixLike/GenDepex b/BaseTools/BinWrap= pers/PosixLike/GenDepex > index bdb6722a1f84..dad174788bc3 100755 > --- a/BaseTools/BinWrappers/PosixLike/GenDepex > +++ b/BaseTools/BinWrappers/PosixLike/GenDepex > @@ -10,5 +10,5 @@ full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.woole= dge.org/BashFAQ/028 for a d > dir=3D$(dirname "$full_cmd") > cmd=3D${full_cmd##*/} >=20 > -export PYTHONPATH=3D"$dir/../../Source/Python" > +export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH= "}" > exec "${python_exe:-python}" "$dir/../../Source/Python/AutoGen/$cmd.py" = "$@" > diff --git a/BaseTools/BinWrappers/PosixLike/GenFds b/BaseTools/BinWrappe= rs/PosixLike/GenFds > index 214d88fff1b1..01ae23ddeb4f 100755 > --- a/BaseTools/BinWrappers/PosixLike/GenFds > +++ b/BaseTools/BinWrappers/PosixLike/GenFds > @@ -10,5 +10,5 @@ full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.woole= dge.org/BashFAQ/028 for a d > dir=3D$(dirname "$full_cmd") > cmd=3D${full_cmd##*/} >=20 > -export PYTHONPATH=3D"$dir/../../Source/Python" > +export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH= "}" > exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@= " > diff --git a/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable b/BaseTools= /BinWrappers/PosixLike/GenPatchPcdTable > index 214d88fff1b1..01ae23ddeb4f 100755 > --- a/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable > +++ b/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable > @@ -10,5 +10,5 @@ full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.woole= dge.org/BashFAQ/028 for a d > dir=3D$(dirname "$full_cmd") > cmd=3D${full_cmd##*/} >=20 > -export PYTHONPATH=3D"$dir/../../Source/Python" > +export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH= "}" > exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@= " > diff --git a/BaseTools/BinWrappers/PosixLike/PatchPcdValue b/BaseTools/Bi= nWrappers/PosixLike/PatchPcdValue > index 214d88fff1b1..01ae23ddeb4f 100755 > --- a/BaseTools/BinWrappers/PosixLike/PatchPcdValue > +++ b/BaseTools/BinWrappers/PosixLike/PatchPcdValue > @@ -10,5 +10,5 @@ full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.woole= dge.org/BashFAQ/028 for a d > dir=3D$(dirname "$full_cmd") > cmd=3D${full_cmd##*/} >=20 > -export PYTHONPATH=3D"$dir/../../Source/Python" > +export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH= "}" > exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@= " > diff --git a/BaseTools/BinWrappers/PosixLike/Pkcs7Sign b/BaseTools/BinWra= ppers/PosixLike/Pkcs7Sign > index 214d88fff1b1..01ae23ddeb4f 100755 > --- a/BaseTools/BinWrappers/PosixLike/Pkcs7Sign > +++ b/BaseTools/BinWrappers/PosixLike/Pkcs7Sign > @@ -10,5 +10,5 @@ full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.woole= dge.org/BashFAQ/028 for a d > dir=3D$(dirname "$full_cmd") > cmd=3D${full_cmd##*/} >=20 > -export PYTHONPATH=3D"$dir/../../Source/Python" > +export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH= "}" > exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@= " > diff --git a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys > b/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys > index 2cddde9d4f0b..1bc1054a3452 100755 > --- a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys > +++ b/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys > @@ -10,5 +10,5 @@ full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.woole= dge.org/BashFAQ/028 for a d > dir=3D$(dirname "$full_cmd") > cmd=3D${full_cmd##*/} >=20 > -export PYTHONPATH=3D"$dir/../../Source/Python" > +export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH= "}" > exec "${python_exe:-python}" "$dir/../../Source/Python/Rsa2048Sha256Sign= /$cmd.py" "$@" > diff --git a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign b/BaseTool= s/BinWrappers/PosixLike/Rsa2048Sha256Sign > index 214d88fff1b1..01ae23ddeb4f 100755 > --- a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign > +++ b/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign > @@ -10,5 +10,5 @@ full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.woole= dge.org/BashFAQ/028 for a d > dir=3D$(dirname "$full_cmd") > cmd=3D${full_cmd##*/} >=20 > -export PYTHONPATH=3D"$dir/../../Source/Python" > +export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH= "}" > exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@= " > diff --git a/BaseTools/BinWrappers/PosixLike/TargetTool b/BaseTools/BinWr= appers/PosixLike/TargetTool > index 214d88fff1b1..01ae23ddeb4f 100755 > --- a/BaseTools/BinWrappers/PosixLike/TargetTool > +++ b/BaseTools/BinWrappers/PosixLike/TargetTool > @@ -10,5 +10,5 @@ full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.woole= dge.org/BashFAQ/028 for a d > dir=3D$(dirname "$full_cmd") > cmd=3D${full_cmd##*/} >=20 > -export PYTHONPATH=3D"$dir/../../Source/Python" > +export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH= "}" > exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@= " > diff --git a/BaseTools/BinWrappers/PosixLike/Trim b/BaseTools/BinWrappers= /PosixLike/Trim > index 7cac4f7c4fff..6c8dde5bec3e 100755 > --- a/BaseTools/BinWrappers/PosixLike/Trim > +++ b/BaseTools/BinWrappers/PosixLike/Trim > @@ -10,5 +10,5 @@ full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.woole= dge.org/BashFAQ/028 for a d > dir=3D$(dirname "$full_cmd") > exe=3D$(basename "$full_cmd") >=20 > -export PYTHONPATH=3D"$dir/../../Source/Python" > +export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH= "}" > exec "${python_exe:-python}" "$dir/../../Source/Python/$exe/$exe.py" "$@= " > diff --git a/BaseTools/BinWrappers/PosixLike/UPT b/BaseTools/BinWrappers/= PosixLike/UPT > index 214d88fff1b1..01ae23ddeb4f 100755 > --- a/BaseTools/BinWrappers/PosixLike/UPT > +++ b/BaseTools/BinWrappers/PosixLike/UPT > @@ -10,5 +10,5 @@ full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.woole= dge.org/BashFAQ/028 for a d > dir=3D$(dirname "$full_cmd") > cmd=3D${full_cmd##*/} >=20 > -export PYTHONPATH=3D"$dir/../../Source/Python" > +export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH= "}" > exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@= " > diff --git a/BaseTools/BinWrappers/PosixLike/build b/BaseTools/BinWrapper= s/PosixLike/build > index 214d88fff1b1..01ae23ddeb4f 100755 > --- a/BaseTools/BinWrappers/PosixLike/build > +++ b/BaseTools/BinWrappers/PosixLike/build > @@ -10,5 +10,5 @@ full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.woole= dge.org/BashFAQ/028 for a d > dir=3D$(dirname "$full_cmd") > cmd=3D${full_cmd##*/} >=20 > -export PYTHONPATH=3D"$dir/../../Source/Python" > +export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH= "}" > exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@= " > -- > 2.14.1.3.gb7cf6e02401b