mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-04-28 11:43:56 +00:00
It is faster to check the existance of a certain library by trying importing that library, instead of invoking pip3 for a complete list of installed libraries. Time of the check can be significantly reduced. # time pip3 list ... real 0m6.038s user 0m0.652s sys 0m0.036s # time python3 -c "import kconfiglib" real 0m0.037s user 0m0.036s sys 0m0.000s Tracked-On: #1588 Signed-off-by: Junjie Mao <junjie.mao@intel.com> Reviewed-by: Anthony Xu <anthony.xu@intel.com>
32 lines
1.1 KiB
Makefile
32 lines
1.1 KiB
Makefile
# usage: check_dep_exec <executable name> <variable>
|
|
#
|
|
# Create a target that checks the existence of the specified executable, and
|
|
# append that target to the given variable.
|
|
define check_dep_exec =
|
|
$(2) += check_exec_$(1)
|
|
check_exec_$(1):
|
|
@if ! which $(1) > /dev/null; then \
|
|
echo "******** Missing prerequisite tool ********"; \
|
|
echo "Cannot find executable *$(1)*"; \
|
|
echo "Please refer to the Getting Started Guide" \
|
|
"for installation instructions"; \
|
|
exit 1; \
|
|
fi
|
|
endef
|
|
|
|
# usage: check_dep_py3lib <library name> <variable>
|
|
#
|
|
# Create a target that checks the existence of the specified python 3 library, and
|
|
# append that target to the given variable.
|
|
define check_dep_py3lib =
|
|
$(2) += check_py3lib_$(1)
|
|
check_py3lib_$(1):
|
|
@if ! python3 -c "import $(1)" > /dev/null 2>&1; then \
|
|
echo "******** Missing prerequisite tool ********"; \
|
|
echo "The python3 library *$(1)* is not installed"; \
|
|
echo "Please refer to the Getting Started Guide" \
|
|
"for installation instructions"; \
|
|
exit 1; \
|
|
fi
|
|
endef
|