Skip to contentSkip to conversation

package/scons: remove python from SCONS

PATCH New Fabrice Fontaine 2 participants 5 messages Mar 31, 2019 – Apr 1, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/scons: remove python from SCONS

Remove $(HOST_DIR)/bin/python from SCONS variable to allow each scons package to select their python interpreter. Indeed, most of the scons packages (alljoyn, benejson, gpsd) only supports python2

Fixes:
- http://autobuild.buildroot.org/results/b45f9fb69615b80758adeff4571e170c3bd9356b
- http://autobuild.buildroot.org/results/13144a7ebd64ef7889312053f06a14047eea232d

---
 package/alljoyn-base/alljoyn-base.mk         |  4 ++--
 package/alljoyn-tcl-base/alljoyn-tcl-base.mk |  4 ++--
 package/alljoyn-tcl/alljoyn-tcl.mk           |  4 ++--
 package/alljoyn/alljoyn.mk                   |  4 ++--
 package/benejson/benejson.mk                 |  4 ++--
 package/gpsd/gpsd.mk                         | 10 +++++-----
 package/mongodb/mongodb.mk                   |  4 ++--
 package/scons/scons.mk                       |  2 +-
 8 files changed, 18 insertions(+), 18 deletions(-)
package/alljoyn-base/alljoyn-base.mk +2 -2
index ad19802823..64ba647ab0 100644
@@ -11,7 +11,7 @@ ALLJOYN_BASE_SITE = \
 # See https://allseenalliance.org/alliance/ip-policy
 ALLJOYN_BASE_LICENSE = ISC
 
-ALLJOYN_BASE_DEPENDENCIES = host-scons alljoyn openssl
+ALLJOYN_BASE_DEPENDENCIES = host-python host-scons alljoyn openssl
 ALLJOYN_BASE_INSTALL_STAGING = YES
 
 ALLJOYN_BASE_CRYPTO = openssl
@@ -68,7 +68,7 @@ endif
 
 define ALLJOYN_BASE_BUILD_CMDS
 	$(foreach target,$(ALLJOYN_BASE_TARGETS),\
-		cd $(@D)/$(target); $(SCONS) $(ALLJOYN_BASE_SCONS_OPTS)
+		cd $(@D)/$(target); $(HOST_DIR)/bin/python2 $(SCONS) $(ALLJOYN_BASE_SCONS_OPTS)
 	)
 endef
 
package/alljoyn-tcl-base/alljoyn-tcl-base.mk +2 -2
index 461cd097d6..f8ef5a3e10 100644
@@ -12,7 +12,7 @@ ALLJOYN_TCL_BASE_SITE = \
 # See https://allseenalliance.org/alliance/ip-policy
 ALLJOYN_TCL_BASE_LICENSE = ISC
 
-ALLJOYN_TCL_BASE_DEPENDENCIES = host-scons alljoyn-tcl
+ALLJOYN_TCL_BASE_DEPENDENCIES = host-python host-scons alljoyn-tcl
 ALLJOYN_TCL_BASE_INSTALL_STAGING = YES
 
 # AllJoyn Base Thin Core can be compiled in debug or release mode. By default,
@@ -29,7 +29,7 @@ ALLJOYN_TCL_BASE_SCONS_OPTS = \
 	WS=off
 
 define ALLJOYN_TCL_BASE_BUILD_CMDS
-	cd $(@D); $(SCONS) $(ALLJOYN_TCL_BASE_SCONS_OPTS)
+	cd $(@D); $(HOST_DIR)/bin/python2 $(SCONS) $(ALLJOYN_TCL_BASE_SCONS_OPTS)
 endef
 
 define ALLJOYN_TCL_BASE_INSTALL_STAGING_CMDS
package/alljoyn-tcl/alljoyn-tcl.mk +2 -2
index cabdf8992a..8981ead378 100644
@@ -12,7 +12,7 @@ ALLJOYN_TCL_SITE = \
 # See https://allseenalliance.org/alliance/ip-policy
 ALLJOYN_TCL_LICENSE = ISC
 
-ALLJOYN_TCL_DEPENDENCIES = host-scons
+ALLJOYN_TCL_DEPENDENCIES = host-python host-scons
 ALLJOYN_TCL_INSTALL_STAGING = YES
 
 # AllJoyn Thin Core can be compiled in debug or release mode. By default,
@@ -27,7 +27,7 @@ ALLJOYN_TCL_SCONS_OPTS = \
 	CXX="$(TARGET_CXX)"
 
 define ALLJOYN_TCL_BUILD_CMDS
-	cd $(@D); $(SCONS) $(ALLJOYN_TCL_SCONS_OPTS)
+	cd $(@D); $(HOST_DIR)/bin/python2 $(SCONS) $(ALLJOYN_TCL_SCONS_OPTS)
 endef
 
 define ALLJOYN_TCL_INSTALL_STAGING_CMDS
package/alljoyn/alljoyn.mk +2 -2
index 1281674e38..d05705c429 100644
@@ -11,7 +11,7 @@ ALLJOYN_SITE = https://mirrors.kernel.org/allseenalliance/alljoyn/$(ALLJOYN_REV)
 # See https://allseenalliance.org/alliance/ip-policy
 ALLJOYN_LICENSE = ISC
 
-ALLJOYN_DEPENDENCIES = host-scons libcap
+ALLJOYN_DEPENDENCIES = host-python host-scons libcap
 ALLJOYN_INSTALL_STAGING = YES
 
 # AllJoyn can be compiled in debug or release mode. By default, AllJoyn is built
@@ -51,7 +51,7 @@ ALLJOYN_SCONS_OPTS = \
 	TARGET_PATH="$(BR_PATH)"
 
 define ALLJOYN_BUILD_CMDS
-	cd $(@D); $(SCONS) $(ALLJOYN_SCONS_OPTS)
+	cd $(@D); $(HOST_DIR)/bin/python2 $(SCONS) $(ALLJOYN_SCONS_OPTS)
 endef
 
 define ALLJOYN_INSTALL_STAGING_CMDS
package/benejson/benejson.mk +2 -2
index 680e5b5bda..0faf5f1cc4 100644
@@ -9,7 +9,7 @@ BENEJSON_SITE = $(call github,codehero,benejson,$(BENEJSON_VERSION))
 BENEJSON_LICENSE = MIT
 BENEJSON_LICENSE_FILES = LICENSE
 BENEJSON_INSTALL_STAGING = YES
-BENEJSON_DEPENDENCIES = host-scons
+BENEJSON_DEPENDENCIES = host-python host-scons
 
 # wchar support needs to be manually disabled
 ifeq ($(BR2_USE_WCHAR),)
@@ -41,7 +41,7 @@ endif # Shared enabled
 define BENEJSON_BUILD_CMDS
 	(cd $(@D); \
 		$(TARGET_CONFIGURE_OPTS) CROSS=$(TARGET_CROSS) \
-		$(SCONS) $(BENEJSON_SCONS_TARGETS))
+		$(HOST_DIR)/bin/python2 $(SCONS) $(BENEJSON_SCONS_TARGETS))
 endef
 
 define BENEJSON_INSTALL_STAGING_CMDS
package/gpsd/gpsd.mk +5 -5
index 48d21348b9..0a17ddc93e 100644
@@ -10,7 +10,7 @@ GPSD_LICENSE = BSD-3-Clause
 GPSD_LICENSE_FILES = COPYING
 GPSD_INSTALL_STAGING = YES
 
-GPSD_DEPENDENCIES = host-scons host-pkgconf
+GPSD_DEPENDENCIES = host-python host-scons host-pkgconf
 
 GPSD_LDFLAGS = $(TARGET_LDFLAGS)
 GPSD_CFLAGS = $(TARGET_CFLAGS)
@@ -206,7 +206,7 @@ GPSD_SCONS_ENV += LDFLAGS="$(GPSD_LDFLAGS)" CFLAGS="$(GPSD_CFLAGS)"
 define GPSD_BUILD_CMDS
 	(cd $(@D); \
 		$(GPSD_SCONS_ENV) \
-		$(SCONS) \
+		$(HOST_DIR)/bin/python2 $(SCONS) \
 		$(GPSD_SCONS_OPTS))
 endef
 
@@ -214,7 +214,7 @@ define GPSD_INSTALL_TARGET_CMDS
 	(cd $(@D); \
 		$(GPSD_SCONS_ENV) \
 		DESTDIR=$(TARGET_DIR) \
-		$(SCONS) \
+		$(HOST_DIR)/bin/python2 $(SCONS) \
 		$(GPSD_SCONS_OPTS) \
 		install)
 endef
@@ -228,7 +228,7 @@ define GPSD_INSTALL_STAGING_CMDS
 	(cd $(@D); \
 		$(GPSD_SCONS_ENV) \
 		DESTDIR=$(STAGING_DIR) \
-		$(SCONS) \
+		$(HOST_DIR)/bin/python2 $(SCONS) \
 		$(GPSD_SCONS_OPTS) \
 		install)
 endef
@@ -240,7 +240,7 @@ define GPSD_INSTALL_UDEV_RULES
 	(cd $(@D); \
 		$(GPSD_SCONS_ENV) \
 		DESTDIR=$(TARGET_DIR) \
-		$(SCONS) \
+		$(HOST_DIR)/bin/python2 $(SCONS) \
 		$(GPSD_SCONS_OPTS) \
 		udev-install)
 	chmod u+w $(TARGET_DIR)/lib/udev/rules.d/25-gpsd.rules
package/mongodb/mongodb.mk +2 -2
index e420ecb41d..53e1ce9963 100644
@@ -74,7 +74,7 @@ endif
 
 define MONGODB_BUILD_CMDS
 	(cd $(@D); \
-		$(SCONS) \
+		$(HOST_DIR)/bin/python $(SCONS) \
 		$(MONGODB_SCONS_ENV) \
 		$(MONGODB_SCONS_OPTS) \
 		$(MONGODB_SCONS_TARGETS))
@@ -82,7 +82,7 @@ endef
 
 define MONGODB_INSTALL_TARGET_CMDS
 	(cd $(@D); \
-		$(SCONS) \
+		$(HOST_DIR)/bin/python $(SCONS) \
 		$(MONGODB_SCONS_ENV) \
 		$(MONGODB_SCONS_OPTS) \
 		--prefix=$(TARGET_DIR)/usr \
package/scons/scons.mk +1 -1
index f146fde904..6533811db7 100644
@@ -16,4 +16,4 @@ HOST_SCONS_INSTALL_OPTS = \
 $(eval $(host-python-package))
 
 # variables used by other packages
-SCONS = $(HOST_DIR)/bin/python $(HOST_DIR)/bin/scons $(if $(QUIET),-s)
+SCONS = $(HOST_DIR)/bin/scons $(if $(QUIET),-s)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/scons: remove python from SCONS

Hello Fabrice,

package/alljoyn-base/alljoyn-base.mk ALLJOYN_BASE_SITE = \ · line 15

Quoted 11 lines · On Sun, 31 Mar 2019 14:18:10 +0200 Fabrice Fontaine…
package/alljoyn-base/alljoyn-base.mk +1 -1
index ad19802823..64ba647ab0 100644
@@ -11,7 +11,7 @@ ALLJOYN_BASE_SITE = \
 # See https://allseenalliance.org/alliance/ip-policy
 ALLJOYN_BASE_LICENSE = ISC
 
-ALLJOYN_BASE_DEPENDENCIES = host-scons alljoyn openssl
+ALLJOYN_BASE_DEPENDENCIES = host-python host-scons alljoyn openssl
 ALLJOYN_BASE_INSTALL_STAGING = YES

Hm, don't we have a problem when BR2_PACKAGE_PYTHON3=y ? In this case, scons being a host-python-package, it will be installed for host-python3, i.e in /usr/lib/python3/.../, so how can it then work to call it using python2 ?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/scons: remove python from SCONS

Hello Thomas,

Le dim. 31 mars 2019 ? 14:25, Thomas Petazzoni
<[email protected]> a ?crit :

Quoted 14 lines

Hello Fabrice,

Quoted 8 lines · On Sun, 31 Mar 2019 14:18:10 +0200 Fabrice Fontaine…
package/alljoyn-base/alljoyn-base.mk +0 -0
index ad19802823..64ba647ab0 100644
@@ -11,7 +11,7 @@ ALLJOYN_BASE_SITE = \
 # See https://allseenalliance.org/alliance/ip-policy
 ALLJOYN_BASE_LICENSE = ISC
 
Quoted 8 lines

package/alljoyn-base/alljoyn-base.mk ALLJOYN_BASE_SITE = \ · line 15

Quoted 3 lines
package/alljoyn-base/alljoyn-base.mk +1 -1
-ALLJOYN_BASE_DEPENDENCIES = host-scons alljoyn openssl
+ALLJOYN_BASE_DEPENDENCIES = host-python host-scons alljoyn openssl
 ALLJOYN_BASE_INSTALL_STAGING = YES

Hm, don't we have a problem when BR2_PACKAGE_PYTHON3=y ? In this case, scons being a host-python-package, it will be installed for host-python3, i.e in /usr/lib/python3/.../, so how can it then work to call it using python2 ?

I tested it with the defconfig from the alljoyn autobuild falures (which have BR2_PACKAGE_PYTHON3=y) and it works because scons script is installed in $(HOST_DIR)/bin/scons and scons libraries are installed in $(HOST_DIR)/lib/scons-$(SCONS_VERSION) because we pass this path through --install-lib in scons.mk.
But perhaps you should try to rebuild it too with these defconfigs to double-check that I did not miss something.

Quoted 6 lines

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Best Regards,

Fabrice

#3 lore raw

PATCH 1/1 package/scons: remove python from SCONS

Quoted 9 lines · On Sun, 31 Mar 2019 14:39:40 +0200 Fabrice Fontaine…
Quoted 4 lines

Hm, don't we have a problem when BR2_PACKAGE_PYTHON3=y ? In this case, scons being a host-python-package, it will be installed for host-python3, i.e in /usr/lib/python3/.../, so how can it then work to call it using python2 ?

I tested it with the defconfig from the alljoyn autobuild falures (which have BR2_PACKAGE_PYTHON3=y) and it works because scons script is installed in $(HOST_DIR)/bin/scons and scons libraries are installed in $(HOST_DIR)/lib/scons-$(SCONS_VERSION) because we pass this path through --install-lib in scons.mk.

Hm, OK, so it means that running scons with python3 works even if it has been installed for python2. Interesting.

I'm not sure what to do here. We could pick your patch as-is and rely on this interesting behavior.

Or introduce two versions of scons, one for each python version, like we did for python-setuptools. I'm not sure.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH 1/1 package/scons: remove python from SCONS

In reply to Fabrice Fontaine
Quoted 9 lines · On Sun, 31 Mar 2019 14:18:10 +0200 Fabrice Fontaine…

Remove $(HOST_DIR)/bin/python from SCONS variable to allow each scons package to select their python interpreter. Indeed, most of the scons packages (alljoyn, benejson, gpsd) only supports python2

Fixes:
- http://autobuild.buildroot.org/results/b45f9fb69615b80758adeff4571e170c3bd9356b
- http://autobuild.buildroot.org/results/13144a7ebd64ef7889312053f06a14047eea232d

Quoted 10 lines
---
 package/alljoyn-base/alljoyn-base.mk         |  4 ++--
 package/alljoyn-tcl-base/alljoyn-tcl-base.mk |  4 ++--
 package/alljoyn-tcl/alljoyn-tcl.mk           |  4 ++--
 package/alljoyn/alljoyn.mk                   |  4 ++--
 package/benejson/benejson.mk                 |  4 ++--
 package/gpsd/gpsd.mk                         | 10 +++++-----
 package/mongodb/mongodb.mk                   |  4 ++--
 package/scons/scons.mk                       |  2 +-
 8 files changed, 18 insertions(+), 18 deletions(-)

I don't know if it is the best/right solution, but it does the job for now, so let's use this for the moment. We can always revisit the SCons integration later if needed.

Applied to mater, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com