From nobody Mon Dec 23 00:15:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1521024871027211.5883528498705; Wed, 14 Mar 2018 03:54:31 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 755C3224872B2; Wed, 14 Mar 2018 03:48:06 -0700 (PDT) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (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 0235321E25690 for ; Wed, 14 Mar 2018 03:48:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DAA6C406E968; Wed, 14 Mar 2018 10:54:26 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-44.rdu2.redhat.com [10.10.120.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 26CF9AB58A; Wed, 14 Mar 2018 10:54:26 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Wed, 14 Mar 2018 11:54:23 +0100 Message-Id: <20180314105423.27682-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 14 Mar 2018 10:54:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 14 Mar 2018 10:54:26 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: [edk2] [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: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 PYTHONPATH with "BaseTools/Source/Python"; instead, we should prepend the latter to the former. 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 Reviewed-by: Liming Gao --- Notes: Repo: https://github.com/lersek/edk2.git Branch: pythonpath 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(-) diff --git a/BaseTools/BinWrappers/PosixLike/BPDG b/BaseTools/BinWrappers/P= osixLike/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.wooledg= e.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/Po= sixLike/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.wooledg= e.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/BinWrappe= rs/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.wooledg= e.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/BinWrappers= /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.wooledg= e.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/B= inWrappers/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.wooledg= e.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/BinW= rappers/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.wooledg= e.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/BinWrapp= ers/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.wooledg= e.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/Ba= seTools/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.wooledg= e.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/BaseTools/= 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.wooledg= e.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/BinWrap= pers/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.wooledg= e.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/P= osixLike/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.wooledg= e.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/Po= sixLike/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.wooledg= e.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/BinWrappers/= 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.wooledg= e.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" "$@" --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel