diff --git a/include/prereq-build.mk b/include/prereq-build.mk index c52ca71908..40df89575d 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -141,6 +141,8 @@ $(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \ $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \ perl --version | grep "perl.*v5")) +$(eval $(call CleanupPython2)) + $(eval $(call SetupHostCommand,python,Please install Python >= 3.5, \ python3.7 -V 2>&1 | grep -E 'Python 3\.[5-9]\.?', \ python3.6 -V 2>&1 | grep -E 'Python 3\.[5-9]\.?', \ diff --git a/include/prereq.mk b/include/prereq.mk index 0f0f253744..83ac21242c 100644 --- a/include/prereq.mk +++ b/include/prereq.mk @@ -66,6 +66,18 @@ define RequireHeader $$(eval $$(call Require,$(1),$(2))) endef +define CleanupPython2 + define Require/python2-cleanup + if [ -f "$(STAGING_DIR_HOST)/bin/python" ] && \ + $(STAGING_DIR_HOST)/bin/python -V 2>&1 | \ + grep -q 'Python 2'; then \ + rm $(STAGING_DIR_HOST)/bin/python; \ + fi + endef + + $$(eval $$(call Require,python2-cleanup)) +endef + define QuoteHostCommand '$(subst ','"'"',$(strip $(1)))' endef