summaryrefslogtreecommitdiff
path: root/BaseTools/BinWrappers
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/BinWrappers')
-rw-r--r--BaseTools/BinWrappers/PosixLike/GenerateCapsule14
-rw-r--r--BaseTools/BinWrappers/WindowsLike/GenerateCapsule.bat1
2 files changed, 15 insertions, 0 deletions
diff --git a/BaseTools/BinWrappers/PosixLike/GenerateCapsule b/BaseTools/BinWrappers/PosixLike/GenerateCapsule
new file mode 100644
index 0000000000..59a6c8ba43
--- /dev/null
+++ b/BaseTools/BinWrappers/PosixLike/GenerateCapsule
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a python2 command is available, use it in preference to python
+if command -v python2 >/dev/null 2>&1; then
+ python_exe=python2
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" "$dir/../../Source/Python/Capsule/$cmd.py" "$@"
diff --git a/BaseTools/BinWrappers/WindowsLike/GenerateCapsule.bat b/BaseTools/BinWrappers/WindowsLike/GenerateCapsule.bat
new file mode 100644
index 0000000000..ca442d181b
--- /dev/null
+++ b/BaseTools/BinWrappers/WindowsLike/GenerateCapsule.bat
@@ -0,0 +1 @@
+@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\Capsule\GenerateCapsule.py %*