]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/PosixLike: honor pre-set PYTHONPATH
authorLaszlo Ersek <lersek@redhat.com>
Wed, 14 Mar 2018 09:58:34 +0000 (10:58 +0100)
committerLaszlo Ersek <lersek@redhat.com>
Wed, 21 Mar 2018 14:53:44 +0000 (15:53 +0100)
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 <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=896
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
13 files changed:
BaseTools/BinWrappers/PosixLike/BPDG
BaseTools/BinWrappers/PosixLike/Ecc
BaseTools/BinWrappers/PosixLike/GenDepex
BaseTools/BinWrappers/PosixLike/GenFds
BaseTools/BinWrappers/PosixLike/GenPatchPcdTable
BaseTools/BinWrappers/PosixLike/PatchPcdValue
BaseTools/BinWrappers/PosixLike/Pkcs7Sign
BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys
BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign
BaseTools/BinWrappers/PosixLike/TargetTool
BaseTools/BinWrappers/PosixLike/Trim
BaseTools/BinWrappers/PosixLike/UPT
BaseTools/BinWrappers/PosixLike/build

index 214d88fff1b15a998a523628d97ecbb8d93a2e1a..01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b 100755 (executable)
@@ -10,5 +10,5 @@ full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a d
 dir=$(dirname "$full_cmd")
 cmd=${full_cmd##*/}
 
-export PYTHONPATH="$dir/../../Source/Python"
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
 exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
index 214d88fff1b15a998a523628d97ecbb8d93a2e1a..01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b 100755 (executable)
@@ -10,5 +10,5 @@ full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a d
 dir=$(dirname "$full_cmd")
 cmd=${full_cmd##*/}
 
-export PYTHONPATH="$dir/../../Source/Python"
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
 exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
index bdb6722a1f8411a6a429053109cbaae5df459321..dad174788bc3e8515267b76b272ace08ebbc9de1 100755 (executable)
@@ -10,5 +10,5 @@ full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a d
 dir=$(dirname "$full_cmd")
 cmd=${full_cmd##*/}
 
-export PYTHONPATH="$dir/../../Source/Python"
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
 exec "${python_exe:-python}" "$dir/../../Source/Python/AutoGen/$cmd.py" "$@"
index 214d88fff1b15a998a523628d97ecbb8d93a2e1a..01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b 100755 (executable)
@@ -10,5 +10,5 @@ full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a d
 dir=$(dirname "$full_cmd")
 cmd=${full_cmd##*/}
 
-export PYTHONPATH="$dir/../../Source/Python"
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
 exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
index 214d88fff1b15a998a523628d97ecbb8d93a2e1a..01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b 100755 (executable)
@@ -10,5 +10,5 @@ full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a d
 dir=$(dirname "$full_cmd")
 cmd=${full_cmd##*/}
 
-export PYTHONPATH="$dir/../../Source/Python"
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
 exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
index 214d88fff1b15a998a523628d97ecbb8d93a2e1a..01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b 100755 (executable)
@@ -10,5 +10,5 @@ full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a d
 dir=$(dirname "$full_cmd")
 cmd=${full_cmd##*/}
 
-export PYTHONPATH="$dir/../../Source/Python"
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
 exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
index 214d88fff1b15a998a523628d97ecbb8d93a2e1a..01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b 100755 (executable)
@@ -10,5 +10,5 @@ full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a d
 dir=$(dirname "$full_cmd")
 cmd=${full_cmd##*/}
 
-export PYTHONPATH="$dir/../../Source/Python"
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
 exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
index 2cddde9d4f0be7c4bbc2d2b73bd4e146c2a40d4e..1bc1054a3452a196cdfa1d2e18dde0f7250f20a2 100755 (executable)
@@ -10,5 +10,5 @@ full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a d
 dir=$(dirname "$full_cmd")
 cmd=${full_cmd##*/}
 
-export PYTHONPATH="$dir/../../Source/Python"
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
 exec "${python_exe:-python}" "$dir/../../Source/Python/Rsa2048Sha256Sign/$cmd.py" "$@"
index 214d88fff1b15a998a523628d97ecbb8d93a2e1a..01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b 100755 (executable)
@@ -10,5 +10,5 @@ full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a d
 dir=$(dirname "$full_cmd")
 cmd=${full_cmd##*/}
 
-export PYTHONPATH="$dir/../../Source/Python"
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
 exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
index 214d88fff1b15a998a523628d97ecbb8d93a2e1a..01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b 100755 (executable)
@@ -10,5 +10,5 @@ full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a d
 dir=$(dirname "$full_cmd")
 cmd=${full_cmd##*/}
 
-export PYTHONPATH="$dir/../../Source/Python"
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
 exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
index 7cac4f7c4fff29fbb4981a25c4492d38317a1fca..6c8dde5bec3eae83e0762f8f36eeb3ab279e86df 100755 (executable)
@@ -10,5 +10,5 @@ full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a d
 dir=$(dirname "$full_cmd")
 exe=$(basename "$full_cmd")
 
-export PYTHONPATH="$dir/../../Source/Python"
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
 exec "${python_exe:-python}" "$dir/../../Source/Python/$exe/$exe.py" "$@"
index 214d88fff1b15a998a523628d97ecbb8d93a2e1a..01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b 100755 (executable)
@@ -10,5 +10,5 @@ full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a d
 dir=$(dirname "$full_cmd")
 cmd=${full_cmd##*/}
 
-export PYTHONPATH="$dir/../../Source/Python"
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
 exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
index 214d88fff1b15a998a523628d97ecbb8d93a2e1a..01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b 100755 (executable)
@@ -10,5 +10,5 @@ full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a d
 dir=$(dirname "$full_cmd")
 cmd=${full_cmd##*/}
 
-export PYTHONPATH="$dir/../../Source/Python"
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
 exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"