mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-12 12:30:08 +00:00
kconfig: a faster way to check the availability of python3 package
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>
This commit is contained in:
@@ -21,7 +21,7 @@ endef
|
||||
define check_dep_py3lib =
|
||||
$(2) += check_py3lib_$(1)
|
||||
check_py3lib_$(1):
|
||||
@if ! pip3 list 2>/dev/null | grep $(1) > /dev/null 2>&1; then \
|
||||
@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" \
|
||||
|
Reference in New Issue
Block a user