Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BaseTools: Use pip module if available, CI uses it by default #1072

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 19 additions & 1 deletion .pytool/CISettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def __init__(self):
self.ActualTargets = []
self.ActualArchitectures = []
self.ActualToolChainTag = ""
self.UseBuiltInBaseTools = None

# ####################################################################################### #
# Extra CmdLine configuration #
Expand Down Expand Up @@ -131,7 +132,24 @@ def GetActiveScopes(self):

self.ActualToolChainTag = shell_environment.GetBuildVars().GetValue("TOOL_CHAIN_TAG", "")

if GetHostInfo().os.upper() == "LINUX" and self.ActualToolChainTag.upper().startswith("GCC"):
is_linux = GetHostInfo().os.upper() == "LINUX"

if self.UseBuiltInBaseTools is None:
is_linux = GetHostInfo().os.upper() == "LINUX"
# try and import the pip module for basetools
try:
import edk2basetools
self.UseBuiltInBaseTools = True
logging.info("Using Pip Tools based BaseTools")
except ImportError:
logging.warning("Falling back to using in-tree BaseTools")
self.UseBuiltInBaseTools = False
pass

if self.UseBuiltInBaseTools == True:
scopes += ('pipbuild-unix',) if is_linux else ('pipbuild-win',)

if is_linux and self.ActualToolChainTag.upper().startswith("GCC"):
if "AARCH64" in self.ActualArchitectures:
scopes += ("gcc_aarch64_linux",)
if "ARM" in self.ActualArchitectures:
Expand Down
14 changes: 14 additions & 0 deletions BaseTools/BinPipWrappers/PosixLike/AmlToC
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*

# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
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")
exe=$(basename "$full_cmd")

export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
exec "${python_exe:-python}" "$dir/../../Source/Python/$exe/$exe.py" "$@"
12 changes: 12 additions & 0 deletions BaseTools/BinPipWrappers/PosixLike/BPDG
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*

# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
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
cmd=${full_cmd##*/}

exec "${python_exe:-python}" -m edk2basetools.$cmd.EccMain "$@"
29 changes: 29 additions & 0 deletions BaseTools/BinPipWrappers/PosixLike/Brotli
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

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##*/}

if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

34 changes: 34 additions & 0 deletions BaseTools/BinPipWrappers/PosixLike/BrotliCompress
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
#
# This script will exec Brotli tool with -e/-d options.
#
# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
QLT="-q 9 -w 22"
ARGS=

while test $# -gt 0
do
case $1 in
-e)
;;
-d)
ARGS+="$1 "
;;
-o|-g)
ARGS+="$1 $2 "
shift
;;
-q)
QLT="$1 $2 "
shift
;;
*)
ARGS+="$1 "
;;
esac
shift
done

exec Brotli $QLT $ARGS
29 changes: 29 additions & 0 deletions BaseTools/BinPipWrappers/PosixLike/DevicePath
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

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##*/}

if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

13 changes: 13 additions & 0 deletions BaseTools/BinPipWrappers/PosixLike/Ecc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*

# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
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
cmd=${full_cmd##*/}

export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
exec "${python_exe:-python}" -m $cmd.EccMain "$@"
29 changes: 29 additions & 0 deletions BaseTools/BinPipWrappers/PosixLike/EfiRom
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

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##*/}

if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

29 changes: 29 additions & 0 deletions BaseTools/BinPipWrappers/PosixLike/GenCrc32
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

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##*/}

if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

12 changes: 12 additions & 0 deletions BaseTools/BinPipWrappers/PosixLike/GenDepex
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*

# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
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
cmd=${full_cmd##*/}

exec "${python_exe:-python}" -m edk2basetools.AutoGen.$cmd "$@"
12 changes: 12 additions & 0 deletions BaseTools/BinPipWrappers/PosixLike/GenFds
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*

# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
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
cmd=${full_cmd##*/}

exec "${python_exe:-python}" -m edk2basetools.$cmd "$@"
29 changes: 29 additions & 0 deletions BaseTools/BinPipWrappers/PosixLike/GenFfs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

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##*/}

if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

29 changes: 29 additions & 0 deletions BaseTools/BinPipWrappers/PosixLike/GenFv
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

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##*/}

if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

29 changes: 29 additions & 0 deletions BaseTools/BinPipWrappers/PosixLike/GenFw
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

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##*/}

if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

12 changes: 12 additions & 0 deletions BaseTools/BinPipWrappers/PosixLike/GenPatchPcdTable
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*

# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
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
cmd=${full_cmd##*/}

exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@"
29 changes: 29 additions & 0 deletions BaseTools/BinPipWrappers/PosixLike/GenSec
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

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##*/}

if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi