Skip to content

Commit

Permalink
build: cleanup possibly dangling Python 2 host symlink
Browse files Browse the repository at this point in the history
When bumping buildroot to Python 3, we need to assure, that Python
symlink in staging bin directory points to Python >= 3.5 as well.

We can't rely completly just on SetupHostCommand as its executed only in
cases when the $(STAGING_DIR_HOST)/bin/python doesn't already exist, so
we need to remove it before running SetupHostCommand.

Acked-by: Yousong Zhou <[email protected]>
Signed-off-by: Petr Štetiar <[email protected]>
  • Loading branch information
ynezz committed Jul 26, 2019
1 parent 19938c8 commit 3b68fb5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/prereq-build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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]\.?', \
Expand Down
12 changes: 12 additions & 0 deletions include/prereq.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3b68fb5

Please sign in to comment.