build: cleanup possibly dangling Python 3 host symlink
When switching from master branch to 19.07 or older, we need to ensure that Python symlink in staging bin directory points to Python 2. 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. This is a cherry-pick of3b68fb57c9with python3 instead of python2 Signed-off-by: Petr Štetiar <ynezz@true.cz> Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com> (cherry picked from commit799de7c641)
This commit is contained in:
		 Etienne Champetier
					Etienne Champetier
				
			
				
					committed by
					
						 Petr Štetiar
						Petr Štetiar
					
				
			
			
				
	
			
			
			 Petr Štetiar
						Petr Štetiar
					
				
			
						parent
						
							dfd8c3bfdc
						
					
				
				
					commit
					c1d19b37d5
				
			| @@ -141,6 +141,8 @@ $(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \ | |||||||
| $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \ | $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \ | ||||||
| 	perl --version | grep "perl.*v5")) | 	perl --version | grep "perl.*v5")) | ||||||
|  |  | ||||||
|  | $(eval $(call CleanupPython3)) | ||||||
|  |  | ||||||
| $(eval $(call SetupHostCommand,python,Please install Python 2.x, \ | $(eval $(call SetupHostCommand,python,Please install Python 2.x, \ | ||||||
| 	python2.7 -V 2>&1 | grep 'Python 2.7', \ | 	python2.7 -V 2>&1 | grep 'Python 2.7', \ | ||||||
| 	python2 -V 2>&1 | grep 'Python 2', \ | 	python2 -V 2>&1 | grep 'Python 2', \ | ||||||
|   | |||||||
| @@ -66,6 +66,18 @@ define RequireHeader | |||||||
|   $$(eval $$(call Require,$(1),$(2))) |   $$(eval $$(call Require,$(1),$(2))) | ||||||
| endef | endef | ||||||
|  |  | ||||||
|  | define CleanupPython3 | ||||||
|  |   define Require/python3-cleanup | ||||||
|  | 	if [ -f "$(STAGING_DIR_HOST)/bin/python" ] && \ | ||||||
|  | 		$(STAGING_DIR_HOST)/bin/python -V 2>&1 | \ | ||||||
|  | 		grep -q 'Python 3'; then \ | ||||||
|  | 			rm $(STAGING_DIR_HOST)/bin/python; \ | ||||||
|  | 	fi | ||||||
|  |   endef | ||||||
|  |  | ||||||
|  |   $$(eval $$(call Require,python3-cleanup)) | ||||||
|  | endef | ||||||
|  |  | ||||||
| define QuoteHostCommand | define QuoteHostCommand | ||||||
| '$(subst ','"'"',$(strip $(1)))' | '$(subst ','"'"',$(strip $(1)))' | ||||||
| endef | endef | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user