From 20685f522067271662c8c425a12e4822de08093d Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Thu, 2 Mar 2017 17:47:29 +0200 Subject: python: split source packages away from compiled packages Well, they're not yet compiled, but in the next commit they should be. People have been complaining [citation needed] to me via email or via Github that Python's performance is crap because it packages sources directly and they're not compiled. And Python has to compile the sources on each run, and on-the-fly. Allowing compilation caching is also a no-no, because I'll get complaints that the flash storage fills up whenever a Python app runs. So, to give the user a choice, the new de-facto packaging for Python packages will be: * ship compiled + [ preferably ] optimized files * package sources separately The problem is that this doubles the number of packages in LEDE/OpenWrt, but build-times should not suffer a big hit, since the compilation is done once, and the install phase should not be too intensive. Oh, and people don't need ship source packages if they don't want to. To do that, a packager needs to just call `$(eval $(call BuildPackage,python--src))` The `python-` prefix is important. Signed-off-by: Alexandru Ardelean --- lang/python/files/python-package.mk | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lang/python/files/python-package.mk') diff --git a/lang/python/files/python-package.mk b/lang/python/files/python-package.mk index 4f05dfebb..e9ec85c6f 100644 --- a/lang/python/files/python-package.mk +++ b/lang/python/files/python-package.mk @@ -34,6 +34,17 @@ endif define PyPackage + define Package/$(1)-src + $(call Package/$(1)) + TITLE+= (sources) + DEPENDS:=$$$$(foreach dep,$$$$(filter +python-%,$$$$(DEPENDS)),$$$$(dep)-src) + endef + + define Package/$(1)-src/description + $(call Package/$(1)/description). + (Contains the Python sources for this package). + endef + # Add default PyPackage filespec none defined ifndef PyPackage/$(1)/filespec define PyPackage/$(1)/filespec @@ -58,16 +69,22 @@ define PyPackage if [ -e files/python-package-install.sh ] ; then \ $(SHELL) files/python-package-install.sh \ "$(PKG_INSTALL_DIR)" "$$(1)" \ + "$(HOST_PYTHON_BIN)" "$$(2)" \ "$$$$$$$$$$(call shvar,PyPackage/$(1)/filespec)" ; \ elif [ -e $(STAGING_DIR)/mk/python-package-install.sh ] ; then \ $(SHELL) $(STAGING_DIR)/mk/python-package-install.sh \ "$(PKG_INSTALL_DIR)" "$$(1)" \ + "$(HOST_PYTHON_BIN)" "$$(2)" \ "$$$$$$$$$$(call shvar,PyPackage/$(1)/filespec)" ; \ else \ echo "No 'python-package-install.sh' script found" ; \ exit 1 ; \ fi endef + + define Package/$(1)-src/install + $$(call Package/$(1)/install,$$(1),sources) + endef endef $(call include_mk, python-host.mk) -- cgit