Skip to content

Commit c7907a8

Browse files
junjiemao1lijinxia
authored andcommitted
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>
1 parent 256108f commit c7907a8

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

hypervisor/scripts/kconfig/kconfig.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ $(eval $(call override_config,PLATFORM,sbl))
3434
$(eval $(call override_config,RELEASE,n))
3535

3636
$(eval $(call check_dep_exec,python3,KCONFIG_DEPS))
37-
$(eval $(call check_dep_exec,pip3,KCONFIG_DEPS))
3837
$(eval $(call check_dep_py3lib,kconfiglib,KCONFIG_DEPS))
3938

4039
# This target invoke silentoldconfig to generate or update a .config. Useful as

scripts/deps.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ endef
2121
define check_dep_py3lib =
2222
$(2) += check_py3lib_$(1)
2323
check_py3lib_$(1):
24-
@if ! pip3 list 2>/dev/null | grep $(1) > /dev/null 2>&1; then \
24+
@if ! python3 -c "import $(1)" > /dev/null 2>&1; then \
2525
echo "******** Missing prerequisite tool ********"; \
2626
echo "The python3 library *$(1)* is not installed"; \
2727
echo "Please refer to the Getting Started Guide" \

0 commit comments

Comments
 (0)