From 2dfdef66a383a0db10d9746a21a9362f18502fe9 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Thu, 9 Apr 2020 19:20:48 +0800 Subject: [PATCH 01/13] python3: Remove include guard for python3-host.mk Since it only defines variables and canned recipes, it is safe to include python3-host.mk more than once. Signed-off-by: Jeffery To --- lang/python/python3-host.mk | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lang/python/python3-host.mk b/lang/python/python3-host.mk index 403d0d282..a2f4d6997 100644 --- a/lang/python/python3-host.mk +++ b/lang/python/python3-host.mk @@ -8,9 +8,6 @@ # Note: include this after `include $(TOPDIR)/rules.mk in your package Makefile # if `python3-package.mk` is included, this will already be included -ifneq ($(__python3_host_mk_inc),1) -__python3_host_mk_inc=1 - # For PYTHON3_VERSION python3_mk_path:=$(dir $(lastword $(MAKEFILE_LIST))) include $(python3_mk_path)python3-version.mk @@ -91,5 +88,3 @@ define Build/Compile/HostPy3Mod ./setup.py $(2), \ $(3)) endef - -endif # __python3_host_mk_inc From 3642b18441a386e0af2b5912b2d823f7b4dd7939 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Thu, 9 Apr 2020 22:42:27 +0800 Subject: [PATCH 02/13] python3: Remove HostPython3 in python3-host.mk HostPython3 only adds a few environment variables before running host Python. It has only two users, Build/Compile/HostPy3RunHost and Build/Compile/HostPy3RunTarget. HostPython3 also accesses $(PYTHON3PATH), even though python3-host.mk does not include python3-package.mk, where the variable is defined. This removes HostPython3 and has its two users run host Python directly. This also combines the environment variables of HostPython3 and the two users into HOST_PYTHON3_VARS and PYTHON3_VARS. Signed-off-by: Jeffery To --- lang/python/python3-host.mk | 45 ++++++++++------------------------ lang/python/python3-package.mk | 44 +++++++++++++++++++-------------- net/uwsgi/Makefile | 2 +- 3 files changed, 39 insertions(+), 52 deletions(-) diff --git a/lang/python/python3-host.mk b/lang/python/python3-host.mk index a2f4d6997..e8a375d13 100644 --- a/lang/python/python3-host.mk +++ b/lang/python/python3-host.mk @@ -22,23 +22,7 @@ HOST_PYTHON3_BIN:=$(HOST_PYTHON3_DIR)/bin/python$(PYTHON3_VERSION) HOST_PYTHON3PATH:=$(HOST_PYTHON3_LIB_DIR):$(HOST_PYTHON3_PKG_DIR) -define HostPython3 - if [ "$(strip $(3))" == "HOST" ]; then \ - export PYTHONPATH="$(HOST_PYTHON3PATH)"; \ - export PYTHONDONTWRITEBYTECODE=0; \ - else \ - export PYTHONPATH="$(PYTHON3PATH)"; \ - export PYTHONDONTWRITEBYTECODE=1; \ - export _python_sysroot="$(STAGING_DIR)"; \ - export _python_prefix="/usr"; \ - export _python_exec_prefix="/usr"; \ - fi; \ - export PYTHONOPTIMIZE=""; \ - $(1) \ - $(HOST_PYTHON3_BIN) $(2); -endef - -define host_python3_settings +HOST_PYTHON3_VARS = \ ARCH="$(HOST_ARCH)" \ CC="$(HOSTCC)" \ CCSHARED="$(HOSTCC) $(HOST_FPIC)" \ @@ -48,22 +32,19 @@ define host_python3_settings CFLAGS="$(HOST_CFLAGS)" \ CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON3_INC_DIR)" \ LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON3_VERSION) -Wl$(comma)-rpath=$(STAGING_DIR_HOSTPKG)/lib" \ - _PYTHON_HOST_PLATFORM=linux2 -endef + _PYTHON_HOST_PLATFORM=linux2 \ + PYTHONPATH="$(HOST_PYTHON3PATH)" \ + PYTHONDONTWRITEBYTECODE=0 \ + PYTHONOPTIMIZE="" -# $(1) => commands to execute before running pythons script +# $(1) => directory of python script # $(2) => python script and its arguments # $(3) => additional variables define Build/Compile/HostPy3RunHost - $(call HostPython3, \ - $(if $(1),$(1);) \ - $(call host_python3_settings) \ - $(3) \ - , \ - $(2) \ - , \ - HOST \ - ) + cd "$(if $(strip $(1)),$(strip $(1)),.)" && \ + $(HOST_PYTHON3_VARS) \ + $(3) \ + $(HOST_PYTHON3_BIN) $(2) endef # Note: I shamelessly copied this from Yousong's logic (from python-packages); @@ -71,7 +52,7 @@ HOST_PYTHON3_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON3_VERSION) # $(1) => packages to install define Build/Compile/HostPy3PipInstall - $(call host_python3_settings) \ + $(HOST_PYTHON3_VARS) \ $(HOST_PYTHON3_PIP) \ --disable-pip-version-check \ --cache-dir "$(DL_DIR)/pip-cache" \ @@ -84,7 +65,7 @@ endef # $(3) => additional variables define Build/Compile/HostPy3Mod $(call Build/Compile/HostPy3RunHost, \ - cd $(HOST_BUILD_DIR)/$(strip $(1)), \ - ./setup.py $(2), \ + $(HOST_BUILD_DIR)/$(strip $(1)), \ + setup.py $(2), \ $(3)) endef diff --git a/lang/python/python3-package.mk b/lang/python/python3-package.mk index 97589b563..0571bb271 100644 --- a/lang/python/python3-package.mk +++ b/lang/python/python3-package.mk @@ -96,26 +96,32 @@ define Py3Package endif # Package/$(1)/install endef -# $(1) => commands to execute before running pythons script +PYTHON3_VARS = \ + CC="$(TARGET_CC)" \ + CCSHARED="$(TARGET_CC) $(FPIC)" \ + CXX="$(TARGET_CXX)" \ + LD="$(TARGET_CC)" \ + LDSHARED="$(TARGET_CC) -shared" \ + CFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON3_INC_DIR)" \ + LDFLAGS="$(TARGET_LDFLAGS) -lpython$(PYTHON3_VERSION)" \ + _PYTHON_HOST_PLATFORM=linux2 \ + __PYVENV_LAUNCHER__="/usr/bin/$(PYTHON3)" \ + PYTHONPATH="$(PYTHON3PATH)" \ + PYTHONDONTWRITEBYTECODE=1 \ + PYTHONOPTIMIZE="" \ + _python_sysroot="$(STAGING_DIR)" \ + _python_prefix="/usr" \ + _python_exec_prefix="/usr" + +# $(1) => directory of python script # $(2) => python script and its arguments # $(3) => additional variables define Build/Compile/HostPy3RunTarget - $(call HostPython3, \ - $(if $(1),$(1);) \ - CC="$(TARGET_CC)" \ - CCSHARED="$(TARGET_CC) $(FPIC)" \ - CXX="$(TARGET_CXX)" \ - LD="$(TARGET_CC)" \ - LDSHARED="$(TARGET_CC) -shared" \ - CFLAGS="$(TARGET_CFLAGS)" \ - CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON3_INC_DIR)" \ - LDFLAGS="$(TARGET_LDFLAGS) -lpython$(PYTHON3_VERSION)" \ - _PYTHON_HOST_PLATFORM=linux2 \ - __PYVENV_LAUNCHER__="/usr/bin/$(PYTHON3)" \ - $(3) \ - , \ - $(2) \ - ) + cd "$(if $(strip $(1)),$(strip $(1)),.)" && \ + $(PYTHON3_VARS) \ + $(3) \ + $(HOST_PYTHON3_BIN) $(2) endef # $(1) => build subdir @@ -124,8 +130,8 @@ endef define Build/Compile/Py3Mod $(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR) $(call Build/Compile/HostPy3RunTarget, \ - cd $(PKG_BUILD_DIR)/$(strip $(1)), \ - ./setup.py $(2), \ + $(PKG_BUILD_DIR)/$(strip $(1)), \ + setup.py $(2), \ $(3)) endef diff --git a/net/uwsgi/Makefile b/net/uwsgi/Makefile index f2b6633b7..9b95027d7 100644 --- a/net/uwsgi/Makefile +++ b/net/uwsgi/Makefile @@ -109,7 +109,7 @@ define Build/Compile $(call Build/Compile/Default,plugin.syslog PROFILE=openwrt) $(call Build/Compile/Default,plugin.cgi PROFILE=openwrt) $(call Build/Compile/HostPy3RunTarget, \ - cd $(PKG_BUILD_DIR), \ + $(PKG_BUILD_DIR), \ uwsgiconfig.py --plugin plugins/python openwrt, \ CPP="$(TARGET_CROSS)cpp" \ LINUX_UNAME_VERSION=$(LINUX_UNAME_VERSION) \ From 87b8f45230c59d2b4c90ee0a2caaa5a22bf3d77a Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Thu, 9 Apr 2020 23:02:14 +0800 Subject: [PATCH 03/13] python3: Rename canned recipes in python3-host.mk This changes the recipe name prefix from Build/Compile/HostPy3 to HostPython3, and clarifies some of the names (RunHost to Run, Mod to ModSetup). Signed-off-by: Jeffery To --- lang/python/python-six/Makefile | 2 +- lang/python/python3-host.mk | 10 +++++----- lang/python/python3-package.mk | 2 +- lang/python/python3-packages/Makefile | 2 +- net/seafile-seahub/Makefile | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lang/python/python-six/Makefile b/lang/python/python-six/Makefile index 3f0250d26..70c90a91a 100644 --- a/lang/python/python-six/Makefile +++ b/lang/python/python-six/Makefile @@ -49,7 +49,7 @@ documentation for more information on what is provided. endef define Host/Compile - $(call Build/Compile/HostPy3Mod,,install --prefix="" --root="$(STAGING_DIR_HOSTPKG)") + $(call HostPython3/ModSetup,,install --prefix="" --root="$(STAGING_DIR_HOSTPKG)") endef Host/Install:= diff --git a/lang/python/python3-host.mk b/lang/python/python3-host.mk index e8a375d13..81b0025b1 100644 --- a/lang/python/python3-host.mk +++ b/lang/python/python3-host.mk @@ -5,7 +5,7 @@ # See /LICENSE for more information. # -# Note: include this after `include $(TOPDIR)/rules.mk in your package Makefile +# Note: include this file after `include $(TOPDIR)/rules.mk in your package Makefile # if `python3-package.mk` is included, this will already be included # For PYTHON3_VERSION @@ -40,7 +40,7 @@ HOST_PYTHON3_VARS = \ # $(1) => directory of python script # $(2) => python script and its arguments # $(3) => additional variables -define Build/Compile/HostPy3RunHost +define HostPython3/Run cd "$(if $(strip $(1)),$(strip $(1)),.)" && \ $(HOST_PYTHON3_VARS) \ $(3) \ @@ -51,7 +51,7 @@ endef HOST_PYTHON3_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON3_VERSION) # $(1) => packages to install -define Build/Compile/HostPy3PipInstall +define HostPython3/PipInstall $(HOST_PYTHON3_VARS) \ $(HOST_PYTHON3_PIP) \ --disable-pip-version-check \ @@ -63,8 +63,8 @@ endef # $(1) => build subdir # $(2) => additional arguments to setup.py # $(3) => additional variables -define Build/Compile/HostPy3Mod - $(call Build/Compile/HostPy3RunHost, \ +define HostPython3/ModSetup + $(call HostPython3/Run, \ $(HOST_BUILD_DIR)/$(strip $(1)), \ setup.py $(2), \ $(3)) diff --git a/lang/python/python3-package.mk b/lang/python/python3-package.mk index 0571bb271..88ab726eb 100644 --- a/lang/python/python3-package.mk +++ b/lang/python/python3-package.mk @@ -142,7 +142,7 @@ PYTHON3_PKG_SETUP_VARS ?= define Py3Build/Compile/Default $(if $(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS), - $(call Build/Compile/HostPy3PipInstall,$(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS)) + $(call HostPython3/PipInstall,$(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS)) ) $(call Build/Compile/Py3Mod, \ $(PYTHON3_PKG_SETUP_DIR), \ diff --git a/lang/python/python3-packages/Makefile b/lang/python/python3-packages/Makefile index e3c8f6225..4310fe920 100644 --- a/lang/python/python3-packages/Makefile +++ b/lang/python/python3-packages/Makefile @@ -101,7 +101,7 @@ HOST_PYTHON3_PIP_INSTALL_CLEANUP:=$(call HOST_PYTHON3_PIP_INSTALL,$(PKG_INSTALL_ define Build/Compile $(foreach pkg,$(CONFIG_PACKAGE_python3-packages-list-host), - $(call Build/Compile/HostPy3RunHost,,$(HOST_PYTHON3_PIP_INSTALL_HOST) $(pkg)) + $(call HostPython3/Run,,$(HOST_PYTHON3_PIP_INSTALL_HOST) $(pkg)) ) $(foreach pkg,$(CONFIG_PACKAGE_python3-packages-list), $(call Build/Compile/HostPy3RunTarget,,$(call HOST_PYTHON3_PIP_INSTALL_TARGET,$(pkg)) $(pkg),$(CONFIG_PACKAGE_python3-packages-envs)) diff --git a/net/seafile-seahub/Makefile b/net/seafile-seahub/Makefile index 4e315ef84..295c7f9f9 100644 --- a/net/seafile-seahub/Makefile +++ b/net/seafile-seahub/Makefile @@ -76,7 +76,7 @@ MAKE_VARS += \ DJANGO_ADMIN_PY="$(STAGING_DIR_HOSTPKG)/bin/django-admin" define Py3Build/Compile - $(call Build/Compile/HostPy3PipInstall,$(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS)) + $(call HostPython3/PipInstall,$(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS)) $(call Build/Compile/Default,locale) $(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR) endef From fc8387614ccd919e5c2308d61924fb5a994c83c5 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Thu, 9 Apr 2020 23:28:07 +0800 Subject: [PATCH 04/13] python3: Rename canned recipes in python3-package.mk This renames "internal" recipes to use the Python3/ prefix and clarifies the names (RunTarget to Run, Mod to ModSetup, Shebang to FixShebang). Signed-off-by: Jeffery To --- lang/python/gunicorn/Makefile | 2 +- lang/python/python-gnupg/Makefile | 2 +- lang/python/python-lxml/Makefile | 2 +- lang/python/python3-package.mk | 12 ++++++------ lang/python/python3-packages/Makefile | 4 ++-- net/scapy/Makefile | 2 +- net/uwsgi/Makefile | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lang/python/gunicorn/Makefile b/lang/python/gunicorn/Makefile index 75f3bef57..49df326d2 100644 --- a/lang/python/gunicorn/Makefile +++ b/lang/python/gunicorn/Makefile @@ -66,7 +66,7 @@ define Package/gunicorn3/install $(PKG_INSTALL_DIR)/usr/bin/gunicorn \ $(1)/usr/bin/gunicorn3 $(LN) gunicorn3 $(1)/usr/bin/gunicorn - $(call Py3Shebang,$(1)/usr/bin/*) + $(call Python3/FixShebang,$(1)/usr/bin/*) endef $(eval $(call Py3Package,python3-gunicorn)) diff --git a/lang/python/python-gnupg/Makefile b/lang/python/python-gnupg/Makefile index 53f716547..fd439b245 100644 --- a/lang/python/python-gnupg/Makefile +++ b/lang/python/python-gnupg/Makefile @@ -50,7 +50,7 @@ Python 3.3, Python 3.4, or PyPy. endef define Py3Build/Compile - $(call Build/Compile/Py3Mod,,\ + $(call Python3/ModSetup,,\ install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \ ) endef diff --git a/lang/python/python-lxml/Makefile b/lang/python/python-lxml/Makefile index c2c7d3ad3..05decd704 100644 --- a/lang/python/python-lxml/Makefile +++ b/lang/python/python-lxml/Makefile @@ -48,7 +48,7 @@ endef TARGET_LDFLAGS += -lxml2 -lxslt -lexslt define Py3Build/Compile - $(call Build/Compile/Py3Mod,, \ + $(call Python3/ModSetup,, \ install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \ --static \ --single-version-externally-managed \ diff --git a/lang/python/python3-package.mk b/lang/python/python3-package.mk index 88ab726eb..b3326eaa8 100644 --- a/lang/python/python3-package.mk +++ b/lang/python/python3-package.mk @@ -34,7 +34,7 @@ ifdef CONFIG_USE_MIPS16 TARGET_CFLAGS += -mno-mips16 -mno-interlink-mips16 endif -define Py3Shebang +define Python3/FixShebang $(SED) "1"'!'"b;s,^#"'!'".*python.*,#"'!'"/usr/bin/python3," -i --follow-symlinks $(1) endef @@ -86,7 +86,7 @@ define Py3Package "$(HOST_PYTHON3_BIN)" "$$(2)" \ "$$$$$$$$$$(call shvar,Py3Package/$(1)/filespec)" && \ if [ -d "$$(1)/usr/bin" ]; then \ - $(call Py3Shebang,$$(1)/usr/bin/*) ; \ + $(call Python3/FixShebang,$$(1)/usr/bin/*) ; \ fi endef @@ -117,7 +117,7 @@ PYTHON3_VARS = \ # $(1) => directory of python script # $(2) => python script and its arguments # $(3) => additional variables -define Build/Compile/HostPy3RunTarget +define Python3/Run cd "$(if $(strip $(1)),$(strip $(1)),.)" && \ $(PYTHON3_VARS) \ $(3) \ @@ -127,9 +127,9 @@ endef # $(1) => build subdir # $(2) => additional arguments to setup.py # $(3) => additional variables -define Build/Compile/Py3Mod +define Python3/ModSetup $(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR) - $(call Build/Compile/HostPy3RunTarget, \ + $(call Python3/Run, \ $(PKG_BUILD_DIR)/$(strip $(1)), \ setup.py $(2), \ $(3)) @@ -144,7 +144,7 @@ define Py3Build/Compile/Default $(if $(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS), $(call HostPython3/PipInstall,$(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS)) ) - $(call Build/Compile/Py3Mod, \ + $(call Python3/ModSetup, \ $(PYTHON3_PKG_SETUP_DIR), \ $(PYTHON3_PKG_SETUP_GLOBAL_ARGS) \ install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \ diff --git a/lang/python/python3-packages/Makefile b/lang/python/python3-packages/Makefile index 4310fe920..b1b37dac0 100644 --- a/lang/python/python3-packages/Makefile +++ b/lang/python/python3-packages/Makefile @@ -104,10 +104,10 @@ define Build/Compile $(call HostPython3/Run,,$(HOST_PYTHON3_PIP_INSTALL_HOST) $(pkg)) ) $(foreach pkg,$(CONFIG_PACKAGE_python3-packages-list), - $(call Build/Compile/HostPy3RunTarget,,$(call HOST_PYTHON3_PIP_INSTALL_TARGET,$(pkg)) $(pkg),$(CONFIG_PACKAGE_python3-packages-envs)) + $(call Python3/Run,,$(call HOST_PYTHON3_PIP_INSTALL_TARGET,$(pkg)) $(pkg),$(CONFIG_PACKAGE_python3-packages-envs)) ) $(foreach pkg,$(CONFIG_PACKAGE_python3-packages-list-cleanup), - $(call Build/Compile/HostPy3RunTarget,,$(HOST_PYTHON3_PIP_INSTALL_CLEANUP) $(pkg),$(CONFIG_PACKAGE_python3-packages-envs)) + $(call Python3/Run,,$(HOST_PYTHON3_PIP_INSTALL_CLEANUP) $(pkg),$(CONFIG_PACKAGE_python3-packages-envs)) ) endef diff --git a/net/scapy/Makefile b/net/scapy/Makefile index 19c06031e..4a3b395d3 100644 --- a/net/scapy/Makefile +++ b/net/scapy/Makefile @@ -37,7 +37,7 @@ define Package/scapy/description endef define Build/Compile - $(call Build/Compile/Py3Mod,., \ + $(call Python3/ModSetup,., \ install --prefix="/usr" --root="$(PKG_INSTALL_DIR)", \ ) endef diff --git a/net/uwsgi/Makefile b/net/uwsgi/Makefile index 9b95027d7..d658c9c28 100644 --- a/net/uwsgi/Makefile +++ b/net/uwsgi/Makefile @@ -108,7 +108,7 @@ define Build/Compile $(call Build/Compile/Default,plugin.logfile PROFILE=openwrt) $(call Build/Compile/Default,plugin.syslog PROFILE=openwrt) $(call Build/Compile/Default,plugin.cgi PROFILE=openwrt) - $(call Build/Compile/HostPy3RunTarget, \ + $(call Python3/Run, \ $(PKG_BUILD_DIR), \ uwsgiconfig.py --plugin plugins/python openwrt, \ CPP="$(TARGET_CROSS)cpp" \ From 0bc1bf55781e31a3513a6a6269f1003b4344d04e Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 10 Apr 2020 22:22:58 +0800 Subject: [PATCH 05/13] python3: Reorder recipes in python3-package.mk Group Python3/* recipes together, group Py3Package and Py3Build together. This also adds headings and whitespace to separate major sections. Signed-off-by: Jeffery To --- lang/python/python3-package.mk | 81 ++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 37 deletions(-) diff --git a/lang/python/python3-package.mk b/lang/python/python3-package.mk index b3326eaa8..81e7cd777 100644 --- a/lang/python/python3-package.mk +++ b/lang/python/python3-package.mk @@ -6,6 +6,7 @@ # # Note: include this after `include $(TOPDIR)/rules.mk in your package Makefile + python3_mk_path:=$(dir $(lastword $(MAKEFILE_LIST))) include $(python3_mk_path)python3-host.mk @@ -34,10 +35,52 @@ ifdef CONFIG_USE_MIPS16 TARGET_CFLAGS += -mno-mips16 -mno-interlink-mips16 endif +PYTHON3_VARS = \ + CC="$(TARGET_CC)" \ + CCSHARED="$(TARGET_CC) $(FPIC)" \ + CXX="$(TARGET_CXX)" \ + LD="$(TARGET_CC)" \ + LDSHARED="$(TARGET_CC) -shared" \ + CFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON3_INC_DIR)" \ + LDFLAGS="$(TARGET_LDFLAGS) -lpython$(PYTHON3_VERSION)" \ + _PYTHON_HOST_PLATFORM=linux2 \ + __PYVENV_LAUNCHER__="/usr/bin/$(PYTHON3)" \ + PYTHONPATH="$(PYTHON3PATH)" \ + PYTHONDONTWRITEBYTECODE=1 \ + PYTHONOPTIMIZE="" \ + _python_sysroot="$(STAGING_DIR)" \ + _python_prefix="/usr" \ + _python_exec_prefix="/usr" + +# $(1) => directory of python script +# $(2) => python script and its arguments +# $(3) => additional variables +define Python3/Run + cd "$(if $(strip $(1)),$(strip $(1)),.)" && \ + $(PYTHON3_VARS) \ + $(3) \ + $(HOST_PYTHON3_BIN) $(2) +endef + +# $(1) => build subdir +# $(2) => additional arguments to setup.py +# $(3) => additional variables +define Python3/ModSetup + $(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR) + $(call Python3/Run, \ + $(PKG_BUILD_DIR)/$(strip $(1)), \ + setup.py $(2), \ + $(3)) +endef + define Python3/FixShebang $(SED) "1"'!'"b;s,^#"'!'".*python.*,#"'!'"/usr/bin/python3," -i --follow-symlinks $(1) endef + +# Py3Package + define Py3Package define Package/$(1)-src @@ -96,44 +139,8 @@ define Py3Package endif # Package/$(1)/install endef -PYTHON3_VARS = \ - CC="$(TARGET_CC)" \ - CCSHARED="$(TARGET_CC) $(FPIC)" \ - CXX="$(TARGET_CXX)" \ - LD="$(TARGET_CC)" \ - LDSHARED="$(TARGET_CC) -shared" \ - CFLAGS="$(TARGET_CFLAGS)" \ - CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON3_INC_DIR)" \ - LDFLAGS="$(TARGET_LDFLAGS) -lpython$(PYTHON3_VERSION)" \ - _PYTHON_HOST_PLATFORM=linux2 \ - __PYVENV_LAUNCHER__="/usr/bin/$(PYTHON3)" \ - PYTHONPATH="$(PYTHON3PATH)" \ - PYTHONDONTWRITEBYTECODE=1 \ - PYTHONOPTIMIZE="" \ - _python_sysroot="$(STAGING_DIR)" \ - _python_prefix="/usr" \ - _python_exec_prefix="/usr" -# $(1) => directory of python script -# $(2) => python script and its arguments -# $(3) => additional variables -define Python3/Run - cd "$(if $(strip $(1)),$(strip $(1)),.)" && \ - $(PYTHON3_VARS) \ - $(3) \ - $(HOST_PYTHON3_BIN) $(2) -endef - -# $(1) => build subdir -# $(2) => additional arguments to setup.py -# $(3) => additional variables -define Python3/ModSetup - $(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR) - $(call Python3/Run, \ - $(PKG_BUILD_DIR)/$(strip $(1)), \ - setup.py $(2), \ - $(3)) -endef +# Py3Build PYTHON3_PKG_SETUP_DIR ?= PYTHON3_PKG_SETUP_GLOBAL_ARGS ?= From 3cdca38dce01553766b032d8bbfce08a35d6555e Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 14 Apr 2020 21:14:49 +0800 Subject: [PATCH 06/13] python3: Move functionality into python3-package.mk This moves functionality from python-package-install.sh into python3-package.mk, so that they can be reused separate from filespec processing. Signed-off-by: Jeffery To --- lang/python/python-package-install.sh | 56 ++------------------- lang/python/python3-package.mk | 70 ++++++++++++++++++++++----- 2 files changed, 62 insertions(+), 64 deletions(-) diff --git a/lang/python/python-package-install.sh b/lang/python/python-package-install.sh index 337727af1..fa42f6f4a 100644 --- a/lang/python/python-package-install.sh +++ b/lang/python/python-package-install.sh @@ -1,11 +1,6 @@ #!/bin/sh set -e -[ -z "$SOURCE_DATE_EPOCH" ] || { - PYTHONHASHSEED="$SOURCE_DATE_EPOCH" - export PYTHONHASHSEED -} - process_filespec() { local src_dir="$1" local dst_dir="$2" @@ -40,56 +35,11 @@ process_filespec() { ) } -delete_empty_dirs() { - local dst_dir="$1" - if [ -d "$dst_dir/usr" ] ; then - find "$dst_dir/usr" -empty -type d -delete - fi -} - -ver="$1" -src_dir="$2" -dst_dir="$3" -python="$4" -mode="$5" -filespec="$6" - -find "$src_dir" -name "*.exe" -delete +src_dir="$1" +dst_dir="$2" +filespec="$3" process_filespec "$src_dir" "$dst_dir" "$filespec" || { echo "process filespec error-ed" exit 1 } - -if [ "$mode" == "sources" ] ; then - # Copy only python source files - find "$dst_dir" -not -type d -not -name "*.py" -delete - - delete_empty_dirs "$dst_dir" - exit 0 -fi - -if [ "$ver" == "3" ] ; then - legacy="-b" -fi -# default max recursion is 10 -max_recursion_level=20 - -# XXX [So that you won't goof as I did] -# Note: Yes, I tried to use the -O & -OO flags here. -# However the generated byte-codes were not portable. -# So, we just stuck to un-optimized byte-codes, -# which is still way better/faster than running -# Python sources all the time. -$python -m compileall -r "$max_recursion_level" $legacy -d '/' "$dst_dir" || { - echo "python -m compileall err-ed" - exit 1 -} - -# Delete source files and pyc [ un-optimized bytecode files ] -# We may want to make this optimization thing configurable later, but not sure atm -find "$dst_dir" -type f -name "*.py" -delete - -delete_empty_dirs "$dst_dir" - -exit 0 diff --git a/lang/python/python3-package.mk b/lang/python/python3-package.mk index 81e7cd777..6fab0f5cd 100644 --- a/lang/python/python3-package.mk +++ b/lang/python/python3-package.mk @@ -75,7 +75,47 @@ define Python3/ModSetup endef define Python3/FixShebang -$(SED) "1"'!'"b;s,^#"'!'".*python.*,#"'!'"/usr/bin/python3," -i --follow-symlinks $(1) + $(SED) "1"'!'"b;s,^#"'!'".*python.*,#"'!'"/usr/bin/python3," -i --follow-symlinks $(1) +endef + +# default max recursion is 10 +PYTHON3_COMPILEALL_MAX_RECURSION_LEVEL:=20 + +# $(1) => directory of python source files to compile +# +# XXX [So that you won't goof as I did] +# Note: Yes, I tried to use the -O & -OO flags here. +# However the generated byte-codes were not portable. +# So, we just stuck to un-optimized byte-codes, +# which is still way better/faster than running +# Python sources all the time. +# +# Setting a fixed hash seed value is less secure than using +# random seed values, but is necessary for reproducible builds +# (for now). +# +# Should revisit this when https://bugs.python.org/issue37596 +# (and other related reproducibility issues) are fixed. +define Python3/CompileAll + $(call Python3/Run,, \ + -m compileall -r "$(PYTHON3_COMPILEALL_MAX_RECURSION_LEVEL)" -b -d '/' $(1), + $(if $(SOURCE_DATE_EPOCH),PYTHONHASHSEED="$(SOURCE_DATE_EPOCH)") + ) +endef + +# $(1) => target directory +define Python3/DeleteSourceFiles + $(FIND) $(1) -type f -name '*.py' -delete +endef + +# $(1) => target directory +define Python3/DeleteNonSourceFiles + $(FIND) $(1) -not -type d -not -name '*.py' -delete +endef + +# $(1) => target directory +define Python3/DeleteEmptyDirs + $(FIND) $(1) -mindepth 1 -empty -type d -not -path '$(1)/CONTROL' -not -path '$(1)/CONTROL/*' -delete endef @@ -122,20 +162,28 @@ define Py3Package ifndef Package/$(1)/install $(call shexport,Py3Package/$(1)/filespec) - define Package/$(1)/install + define Package/$(1)/install $$(call Py3Package/$(1)/install,$$(1)) - $(SHELL) $(python3_mk_path)python-package-install.sh "3" \ + $(SHELL) $(python3_mk_path)python-package-install.sh \ "$(PKG_INSTALL_DIR)" "$$(1)" \ - "$(HOST_PYTHON3_BIN)" "$$(2)" \ - "$$$$$$$$$$(call shvar,Py3Package/$(1)/filespec)" && \ - if [ -d "$$(1)/usr/bin" ]; then \ - $(call Python3/FixShebang,$$(1)/usr/bin/*) ; \ + "$$$$$$$$$$(call shvar,Py3Package/$(1)/filespec)" + $(FIND) $$(1) -name '*.exe' -delete + $$(call Python3/CompileAll,$$(1)) + $$(call Python3/DeleteSourceFiles,$$(1)) + $$(call Python3/DeleteEmptyDirs,$$(1)) + if [ -d "$$(1)/usr/bin" ]; then \ + $$(call Python3/FixShebang,$$(1)/usr/bin/*) ; \ fi - endef + endef - define Package/$(1)-src/install - $$(call Package/$(1)/install,$$(1),sources) - endef + define Package/$(1)-src/install + $$(call Py3Package/$(1)/install,$$(1)) + $(SHELL) $(python3_mk_path)python-package-install.sh \ + "$(PKG_INSTALL_DIR)" "$$(1)" \ + "$$$$$$$$$$(call shvar,Py3Package/$(1)/filespec)" + $$(call Python3/DeleteNonSourceFiles,$$(1)) + $$(call Python3/DeleteEmptyDirs,$$(1)) + endef endif # Package/$(1)/install endef From c9b260f5ae9aee3de15f704ee454acfdef4c7579 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 15 Apr 2020 15:11:01 +0800 Subject: [PATCH 07/13] python3: Add canned recipe to invoke filespec processing This extracts filespec export and processing into Py3Package/ProcessFilespec. This also allows the filespec variable to be explicitly set to an empty value, to bypass filespec processing. (The default filespec is also available as Py3Package/filespec/Default to be explicitly assigned to the filespec variable.) Signed-off-by: Jeffery To --- lang/python/python3-package.mk | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/lang/python/python3-package.mk b/lang/python/python3-package.mk index 6fab0f5cd..b8ab01348 100644 --- a/lang/python/python3-package.mk +++ b/lang/python/python3-package.mk @@ -121,6 +121,19 @@ endef # Py3Package +define Py3Package/filespec/Default ++|$(PYTHON3_PKG_DIR) +endef + +# $(1) => package name +# $(2) => src directory +# $(3) => dest directory +define Py3Package/ProcessFilespec + $(eval $(call shexport,Py3Package/$(1)/filespec)) + $(SHELL) $(python3_mk_path)python-package-install.sh \ + "$(2)" "$(3)" "$$$$$(call shvar,Py3Package/$(1)/filespec)" +endef + define Py3Package define Package/$(1)-src @@ -144,10 +157,8 @@ define Py3Package endef # Add default PyPackage filespec none defined - ifndef Py3Package/$(1)/filespec - define Py3Package/$(1)/filespec - +|$(PYTHON3_PKG_DIR) - endef + ifeq ($(origin Py3Package/$(1)/filespec),undefined) + Py3Package/$(1)/filespec=$$(Py3Package/filespec/Default) endif ifndef Py3Package/$(1)/install @@ -160,13 +171,9 @@ define Py3Package endif ifndef Package/$(1)/install - $(call shexport,Py3Package/$(1)/filespec) - define Package/$(1)/install $$(call Py3Package/$(1)/install,$$(1)) - $(SHELL) $(python3_mk_path)python-package-install.sh \ - "$(PKG_INSTALL_DIR)" "$$(1)" \ - "$$$$$$$$$$(call shvar,Py3Package/$(1)/filespec)" + $$(call Py3Package/ProcessFilespec,$(1),$(PKG_INSTALL_DIR),$$(1)) $(FIND) $$(1) -name '*.exe' -delete $$(call Python3/CompileAll,$$(1)) $$(call Python3/DeleteSourceFiles,$$(1)) @@ -178,9 +185,7 @@ define Py3Package define Package/$(1)-src/install $$(call Py3Package/$(1)/install,$$(1)) - $(SHELL) $(python3_mk_path)python-package-install.sh \ - "$(PKG_INSTALL_DIR)" "$$(1)" \ - "$$$$$$$$$$(call shvar,Py3Package/$(1)/filespec)" + $$(call Py3Package/ProcessFilespec,$(1),$(PKG_INSTALL_DIR),$$(1)) $$(call Python3/DeleteNonSourceFiles,$$(1)) $$(call Python3/DeleteEmptyDirs,$$(1)) endef From ba127c155a104be0a93c6f85877db0d6f27ba9df Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 15 Apr 2020 21:55:17 +0800 Subject: [PATCH 08/13] python3: Minor edits for python3-package.mk * Remove PYTHON3_BIN_DIR, it isn't used anywhere in the repo * Rephrase *-src package description * Reduce Py3Package/$(1)/install indentation Signed-off-by: Jeffery To --- lang/python/python3-package.mk | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lang/python/python3-package.mk b/lang/python/python3-package.mk index b8ab01348..fe0df5a11 100644 --- a/lang/python/python3-package.mk +++ b/lang/python/python3-package.mk @@ -5,13 +5,12 @@ # See /LICENSE for more information. # -# Note: include this after `include $(TOPDIR)/rules.mk in your package Makefile +# Note: include this file after `include $(TOPDIR)/rules.mk in your package Makefile python3_mk_path:=$(dir $(lastword $(MAKEFILE_LIST))) include $(python3_mk_path)python3-host.mk PYTHON3_DIR:=$(STAGING_DIR)/usr -PYTHON3_BIN_DIR:=$(PYTHON3_DIR)/bin PYTHON3_INC_DIR:=$(PYTHON3_DIR)/include/python$(PYTHON3_VERSION) PYTHON3_LIB_DIR:=$(PYTHON3_DIR)/lib/python$(PYTHON3_VERSION) @@ -135,7 +134,6 @@ define Py3Package/ProcessFilespec endef define Py3Package - define Package/$(1)-src $(call Package/$(1)) DEPENDS:= @@ -148,8 +146,9 @@ define Py3Package endef define Package/$(1)-src/description - $(call Package/$(1)/description). - (Contains the Python3 sources for this package). + $$(call Package/$(1)/description) + + This package contains the Python source files for $(1). endef define Package/$(1)-src/config @@ -163,10 +162,10 @@ define Py3Package ifndef Py3Package/$(1)/install define Py3Package/$(1)/install - if [ -d $(PKG_INSTALL_DIR)/usr/bin ]; then \ - $(INSTALL_DIR) $$(1)/usr/bin ; \ - $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $$(1)/usr/bin/ ; \ - fi + if [ -d $(PKG_INSTALL_DIR)/usr/bin ]; then \ + $(INSTALL_DIR) $$(1)/usr/bin ; \ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $$(1)/usr/bin/ ; \ + fi endef endif From 58719a3c4bd75479f992982bef3b77fef8310726 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 15 Apr 2020 21:58:40 +0800 Subject: [PATCH 09/13] python3: Remove MIPS16 changes from python3-package.mk There are no bug reports or other evidence to suggest Python is not compatible with MIPS16 compilation. Signed-off-by: Jeffery To --- lang/python/python3-package.mk | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lang/python/python3-package.mk b/lang/python/python3-package.mk index fe0df5a11..878108c54 100644 --- a/lang/python/python3-package.mk +++ b/lang/python/python3-package.mk @@ -27,13 +27,6 @@ CONFIGURE_ARGS += \ _python_prefix="/usr" \ _python_exec_prefix="/usr" -PKG_USE_MIPS16:=0 -# This is required in addition to PKG_USE_MIPS16:=0 because otherwise MIPS16 -# flags are inherited from the Python base package (via sysconfig module) -ifdef CONFIG_USE_MIPS16 - TARGET_CFLAGS += -mno-mips16 -mno-interlink-mips16 -endif - PYTHON3_VARS = \ CC="$(TARGET_CC)" \ CCSHARED="$(TARGET_CC) $(FPIC)" \ From 9636f6f4477c228e0b3c23f4082b53ab7c61f3ce Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 17 Apr 2020 22:09:32 +0800 Subject: [PATCH 10/13] python3: Use PYTHON3_PKG_BUILD to control default Python package build This replaces the use of BUILD_VARIANT with PYTHON3_PKG_BUILD to opt in/out of the default Python package build recipe (Py3Build/Compile). PYTHON3_PKG_BUILD defaults to true (1), i.e. if a package includes python3-package.mk, then by default it will set the package's Build/Compile to Py3Build/Compile. If PYTHON3_PKG_BUILD is set to 0 before python3-package.mk is included, then Build/Compile will not be modified. Signed-off-by: Jeffery To --- lang/python/python3-package.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lang/python/python3-package.mk b/lang/python/python3-package.mk index 878108c54..b16773263 100644 --- a/lang/python/python3-package.mk +++ b/lang/python/python3-package.mk @@ -207,8 +207,8 @@ endef Py3Build/Compile=$(Py3Build/Compile/Default) -ifeq ($(BUILD_VARIANT),python3) -define Build/Compile - $(call Py3Build/Compile) -endef -endif # python3 +PYTHON3_PKG_BUILD ?= 1 + +ifeq ($(strip $(PYTHON3_PKG_BUILD)),1) + Build/Compile=$(Py3Build/Compile) +endif From 1bc2f4f3c6216ece87f0821d68e4e25f821dc382 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 17 Apr 2020 22:23:39 +0800 Subject: [PATCH 11/13] treewide: Remove Python variants for non-Python packages This removes Python-related build variants, and adds PYTHON3_PKG_BUILD:=0 and minor build adjustments (where appropriate), for non-Python packages. There should be no changes to build output. This also updates some include paths for python3-package.mk and/or python3-host.mk to be relative to the package Makefile. Signed-off-by: Jeffery To --- admin/nyx/Makefile | 3 +-- devel/asu/Makefile | 3 +-- devel/meson/Makefile | 3 +-- libs/libgpiod/Makefile | 1 + libs/newt/Makefile | 6 ++---- multimedia/youtube-dl/Makefile | 3 +-- net/freeradius3/Makefile | 4 ++-- net/nmap/Makefile | 12 ++++++------ net/openvswitch/Makefile | 1 + net/radicale/Makefile | 3 +-- net/radicale2/Makefile | 3 +-- net/samba4/Makefile | 7 ++++--- net/sysrepo/Makefile | 1 + net/uwsgi/Makefile | 1 + utils/bigclown/bigclown-control-tool/Makefile | 3 +-- utils/bigclown/bigclown-firmware-tool/Makefile | 3 +-- utils/bigclown/bigclown-gateway/Makefile | 3 +-- utils/bigclown/bigclown-mqtt2influxdb/Makefile | 3 +-- utils/i2c-tools/Makefile | 18 +++++------------- 19 files changed, 33 insertions(+), 48 deletions(-) diff --git a/admin/nyx/Makefile b/admin/nyx/Makefile index a572fb893..5a7e26b41 100644 --- a/admin/nyx/Makefile +++ b/admin/nyx/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nyx PKG_VERSION:=2.1.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PYPI_NAME:=nyx PKG_HASH:=88521488d1c9052e457b9e66498a4acfaaa3adf3adc5a199892632f129a5390b @@ -21,7 +21,6 @@ define Package/nyx URL:=https://nyx.torproject.org/ TITLE:=Terminal status monitor for Tor DEPENDS:=+python3 +python3-stem - VARIANT:=python3 endef define Package/nyx/description diff --git a/devel/asu/Makefile b/devel/asu/Makefile index a6f0a8ef5..54d55f245 100644 --- a/devel/asu/Makefile +++ b/devel/asu/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=asu PKG_VERSION:=0.2.3 -PKG_RELEASE=2 +PKG_RELEASE:=3 PKG_LICENSE:=GPL-3.0 @@ -37,7 +37,6 @@ define Package/asu +gunicorn3 +python3-openssl +python3-pyodbc +python3-yaml \ +libustream-mbedtls +ca-certificates +gnupg USERID:=asu:asu - VARIANT:=python3 endef define Package/asu/description diff --git a/devel/meson/Makefile b/devel/meson/Makefile index b9af6f71c..5762ad773 100644 --- a/devel/meson/Makefile +++ b/devel/meson/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=meson PKG_VERSION:=0.54.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PYPI_NAME:=meson PKG_HASH:=dde5726d778112acbd4a67bb3633ab2ee75d33d1e879a6283a7b4a44c3363c27 @@ -40,7 +40,6 @@ define Package/meson TITLE:=meson URL:=https://mesonbuild.com/ DEPENDS:=+ninja +python3-pkg-resources - VARIANT:=python3 endef define Package/meson/description diff --git a/libs/libgpiod/Makefile b/libs/libgpiod/Makefile index 86604b2de..11bf13ae8 100644 --- a/libs/libgpiod/Makefile +++ b/libs/libgpiod/Makefile @@ -22,6 +22,7 @@ PKG_MAINTAINER:=Michael Heimpold PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 +PYTHON3_PKG_BUILD:=0 include $(INCLUDE_DIR)/package.mk include ../../lang/python/python3-package.mk diff --git a/libs/newt/Makefile b/libs/newt/Makefile index 10abe55f4..dd4ddcb2c 100644 --- a/libs/newt/Makefile +++ b/libs/newt/Makefile @@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=newt PKG_VERSION:=0.52.21 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://releases.pagure.org/newt @@ -24,6 +24,7 @@ PKG_CPE_ID:=cpe:/a:fedorahosted:newt PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 +PYTHON3_PKG_BUILD:=0 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/nls.mk @@ -73,7 +74,6 @@ $(call Package/newt/Default) SUBMENU:=Python TITLE+= module for Python DEPENDS:=+libnewt +python3-light - VARIANT:=python3 endef define Package/python3-newt/description @@ -93,8 +93,6 @@ CONFIGURE_VARS += $(if $(CONFIG_BUILD_NLS),ac_cv_lib_c_gettext=no) MAKE_VARS+= PYTHON_CONFIG_PATH="$(STAGING_DIR)/host/bin" -Build/Compile=$(call Build/Compile/Default,) - define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include $(CP) $(PKG_INSTALL_DIR)/usr/include/newt.h $(1)/usr/include/ diff --git a/multimedia/youtube-dl/Makefile b/multimedia/youtube-dl/Makefile index 2d025ff6c..7e3a2f1fe 100644 --- a/multimedia/youtube-dl/Makefile +++ b/multimedia/youtube-dl/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=youtube-dl PKG_VERSION:=2020.3.24 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PYPI_NAME:=youtube_dl PKG_HASH:=4b03efe439f7cae26eba909821d1df00a9a4eb82741cb2e8b78fe29702bd4633 @@ -35,7 +35,6 @@ define Package/youtube-dl +python3-codecs \ +python3-ctypes \ +python3-setuptools - VARIANT:=python3 endef define Package/youtube-dl/description diff --git a/net/freeradius3/Makefile b/net/freeradius3/Makefile index ef32b33cc..a7085a94c 100644 --- a/net/freeradius3/Makefile +++ b/net/freeradius3/Makefile @@ -22,6 +22,7 @@ PKG_CPE_ID:=cpe:/a:freeradius:freeradius PKG_BUILD_DIR:=$(BUILD_DIR)/freeradius-server-$(PKG_VERSION) PKG_FIXUP:=autoreconf +PYTHON3_PKG_BUILD:=0 PKG_CONFIG_DEPENDS := \ FREERADIUS3_OPENSSL \ @@ -30,7 +31,7 @@ PKG_CONFIG_DEPENDS := \ CFLAGS += $(FPIC) include $(INCLUDE_DIR)/package.mk -include $(TOPDIR)/feeds/packages/lang/python/python3-package.mk +include ../../lang/python/python3-package.mk define Package/freeradius3/config source "$(SOURCE)/Config.in" @@ -766,7 +767,6 @@ $(eval $(call BuildPlugin,freeradius3-mod-mschap,rlm_mschap,)) $(eval $(call BuildPlugin,freeradius3-mod-pap,rlm_pap,)) $(eval $(call BuildPlugin,freeradius3-mod-passwd,rlm_passwd,)) $(eval $(call BuildPlugin,freeradius3-mod-preprocess,rlm_preprocess,)) -$(eval $(call Py3Package,freeradius3-mod-python3)) $(eval $(call BuildPlugin,freeradius3-mod-python3,rlm_python3,)) $(eval $(call BuildPlugin,freeradius3-mod-radutmp,rlm_radutmp,)) $(eval $(call BuildPlugin,freeradius3-mod-realm,rlm_realm,)) diff --git a/net/nmap/Makefile b/net/nmap/Makefile index 46c047981..648ade267 100644 --- a/net/nmap/Makefile +++ b/net/nmap/Makefile @@ -14,7 +14,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nmap PKG_VERSION:=7.80 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MAINTAINER:=Nuno Goncalves PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 @@ -26,6 +26,7 @@ PKG_CPE_ID:=cpe:/a:nmap:nmap PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 +PYTHON3_PKG_BUILD:=0 include $(INCLUDE_DIR)/package.mk include ../../lang/python/python3-package.mk @@ -100,7 +101,6 @@ endef define Package/ndiff $(call Package/nmap/default) DEPENDS:=+python3-light +python3-xml - VARIANT:=python3 TITLE:=Utility to compare the results of Nmap scans endef @@ -148,10 +148,10 @@ CONFIGURE_VARS += \ PYTHON3_PKG_SETUP_DIR:=ndiff PYTHON3_PKG_SETUP_ARGS:= -ifeq ($(BUILD_VARIANT),python3) - Build/Configure:=: - Build/Install:=: -endif +define Build/Compile + $(call Build/Compile/Default,) + $(call Py3Build/Compile) +endef define Package/nmap/install $(INSTALL_DIR) $(1)/usr/bin diff --git a/net/openvswitch/Makefile b/net/openvswitch/Makefile index 09ff2b4a7..76ba560e2 100644 --- a/net/openvswitch/Makefile +++ b/net/openvswitch/Makefile @@ -32,6 +32,7 @@ PKG_USE_MIPS16:=0 PKG_BUILD_PARALLEL:=1 PKG_FIXUP:=autoreconf PKG_INSTALL:=1 +PYTHON3_PKG_BUILD:=0 PKG_MAINTAINER:=Yousong Zhou diff --git a/net/radicale/Makefile b/net/radicale/Makefile index ac73d6762..5422fa7c6 100644 --- a/net/radicale/Makefile +++ b/net/radicale/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=radicale PKG_VERSION:=1.1.6 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PYPI_NAME:=Radicale PKG_HASH:=c007198ea45ef797344672c681d4c13f8b4aa85c15c41a1156225767a405c92b @@ -37,7 +37,6 @@ define Package/radicale +python3-xml USERID:=radicale=5232:radicale=5232 PROVIDES:=radicale-py2 radicale-py3 - VARIANT:=python3 endef define Package/radicale/description diff --git a/net/radicale2/Makefile b/net/radicale2/Makefile index 02700a6b5..455053784 100644 --- a/net/radicale2/Makefile +++ b/net/radicale2/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=radicale2 PKG_VERSION:=2.1.11 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=GPL-3.0 PKG_LICENSE_FILES:=COPYING @@ -31,7 +31,6 @@ $(call Package/radicale2/Default) USERID:=radicale2=225:radicale2=225 DEPENDS:=+python3 +python3-dateutil +python3-vobject +python3-setuptools CONFLICTS:=radicale - VARIANT:=python3 endef define Package/radicale2-examples diff --git a/net/samba4/Makefile b/net/samba4/Makefile index 078c286af..5fcf17436 100644 --- a/net/samba4/Makefile +++ b/net/samba4/Makefile @@ -33,13 +33,14 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_kmod-fs-btrfs \ CONFIG_PACKAGE_kmod-fs-xfs +PYTHON3_PKG_BUILD:=0 + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/version.mk -include $(TOPDIR)/feeds/packages/lang/python/python3-host.mk -#include $(TOPDIR)/feeds/packages/lang/python/python-package.mk -include $(TOPDIR)/feeds/packages/lang/python/python3-package.mk +include ../../lang/python/python3-host.mk +include ../../lang/python/python3-package.mk define Package/samba4/Default SECTION:=net diff --git a/net/sysrepo/Makefile b/net/sysrepo/Makefile index 72396aa5d..13fc9d79c 100644 --- a/net/sysrepo/Makefile +++ b/net/sysrepo/Makefile @@ -22,6 +22,7 @@ PKG_LICENSE_FILES:=LICENSE CMAKE_INSTALL:=1 PKG_BUILD_PARALLEL:=1 PKG_BUILD_DEPENDS:=swig/host +PYTHON3_PKG_BUILD:=0 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk diff --git a/net/uwsgi/Makefile b/net/uwsgi/Makefile index d658c9c28..57e236204 100644 --- a/net/uwsgi/Makefile +++ b/net/uwsgi/Makefile @@ -9,6 +9,7 @@ PKG_SOURCE_URL=https://files.pythonhosted.org/packages/source/u/uwsgi/ PKG_HASH:=4972ac538800fb2d421027f49b4a1869b66048839507ccf0aa2fda792d99f583 PKG_BUILD_DIR:=$(BUILD_DIR)/uwsgi-$(PKG_VERSION) PKG_BUILD_DEPENDS:=python3/host +PYTHON3_PKG_BUILD:=0 PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=LICENSE diff --git a/utils/bigclown/bigclown-control-tool/Makefile b/utils/bigclown/bigclown-control-tool/Makefile index 100a3be77..6e8db708b 100644 --- a/utils/bigclown/bigclown-control-tool/Makefile +++ b/utils/bigclown/bigclown-control-tool/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bigclown-control-tool PKG_VERSION:=0.2.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PYPI_NAME:=bch PKG_HASH:=4cd73b92757fce7275a4744baed411c867af2e671c521b90d6690b2320851d58 @@ -32,7 +32,6 @@ define Package/bigclown-control-tool +python3-pyserial \ +python3-yaml \ +python3-simplejson - VARIANT:=python3 endef $(eval $(call Py3Package,bigclown-control-tool)) diff --git a/utils/bigclown/bigclown-firmware-tool/Makefile b/utils/bigclown/bigclown-firmware-tool/Makefile index c9a6ce943..5596a3638 100644 --- a/utils/bigclown/bigclown-firmware-tool/Makefile +++ b/utils/bigclown/bigclown-firmware-tool/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bigclown-firmware-tool PKG_VERSION:=1.5.1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PYPI_NAME:=bcf PKG_HASH:=50b0351b97e6b1b1d4cb4703491daa6102e7e5b3b750b47fa35182d9eb39ab9c @@ -34,7 +34,6 @@ define Package/bigclown-firmware-tool +python3-requests \ +python3-click \ +python3-intelhex - VARIANT:=python3 endef $(eval $(call Py3Package,bigclown-firmware-tool)) diff --git a/utils/bigclown/bigclown-gateway/Makefile b/utils/bigclown/bigclown-gateway/Makefile index 1419d16f9..af0fe8554 100644 --- a/utils/bigclown/bigclown-gateway/Makefile +++ b/utils/bigclown/bigclown-gateway/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bigclown-gateway PKG_VERSION:=1.16.2 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PYPI_NAME:=bcg PKG_HASH:=ce7f27f372551c0beb3f8929af2d779417d9dcd0feaa2fa2dc49e87b1416c536 @@ -36,7 +36,6 @@ define Package/bigclown-gateway +python3-simplejson \ +python3-schema \ +python3-appdirs - VARIANT:=python3 endef define Py3Package/bigclown-gateway/install diff --git a/utils/bigclown/bigclown-mqtt2influxdb/Makefile b/utils/bigclown/bigclown-mqtt2influxdb/Makefile index c405ba8bd..ab57a10d4 100644 --- a/utils/bigclown/bigclown-mqtt2influxdb/Makefile +++ b/utils/bigclown/bigclown-mqtt2influxdb/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bigclown-mqtt2influxdb PKG_VERSION:=1.3.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PYPI_NAME:=mqtt2influxdb PKG_HASH:=1b4b3b13f5b2f092bcd27846d94e91ad6f05141b2daea5167a7d58b09a782639 @@ -31,7 +31,6 @@ define Package/bigclown-mqtt2influxdb +python3-influxdb \ +python3-jsonpath-ng \ +python3-schema - VARIANT:=python3 endef define Py3Package/bigclown-mqtt2influxdb/install diff --git a/utils/i2c-tools/Makefile b/utils/i2c-tools/Makefile index 388006360..79d6272e7 100644 --- a/utils/i2c-tools/Makefile +++ b/utils/i2c-tools/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=i2c-tools PKG_VERSION:=4.1 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/utils/i2c-tools @@ -20,13 +20,11 @@ PKG_LICENSE:=GPL-2.0-or-later LGPL-2.1-or-later PKG_LICENSE_FILES:=COPYING COPYING.LGPL PKG_BUILD_PARALLEL:=1 -PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-i2c-tools-$(PKG_VERSION) +PYTHON3_PKG_BUILD:=0 include $(INCLUDE_DIR)/package.mk include ../../lang/python/python3-package.mk -PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xJf $(DL_DIR)/$(PKG_SOURCE) - define Package/i2c/Default URL:=https://i2c.wiki.kernel.org/index.php/I2C_Tools TITLE:=I2C @@ -37,7 +35,6 @@ define Package/libi2c SECTION:=libs CATEGORY:=Libraries TITLE+=library for i2c-tools - VARIANT:=bin endef define Package/i2c-tools @@ -46,7 +43,6 @@ define Package/i2c-tools CATEGORY:=Utilities TITLE+=tools for Linux DEPENDS:=+libi2c - VARIANT:=bin endef define Package/python3-smbus @@ -56,7 +52,6 @@ define Package/python3-smbus CATEGORY:=Languages TITLE:=Python bindings for the SMBUS DEPENDS:=+libi2c +python3-light - VARIANT:=python3 endef define Package/libi2c/description @@ -72,7 +67,8 @@ define Package/python3-smbus/description This package contain the Python3 bindings for Linux SMBus access through i2c-dev. endef -ifeq ($(BUILD_VARIANT),bin) +PYTHON3_PKG_SETUP_ARGS:= +PYTHON3_PKG_SETUP_DIR:=py-smbus define Build/Compile $(MAKE) -C $(PKG_BUILD_DIR) \ @@ -81,6 +77,7 @@ define Build/Compile STAGING_DIR="$(STAGING_DIR)" \ LDFLAGS="$(TARGET_LDFLAGS)" \ CFLAGS="$(TARGET_CFLAGS)" + $(call Py3Build/Compile) endef define Build/InstallDev @@ -89,11 +86,6 @@ define Build/InstallDev $(CP) $(PKG_BUILD_DIR)/lib/libi2c.{a,so*} $(1)/usr/lib/ endef -endif # ifeq - -PYTHON3_PKG_SETUP_ARGS:= -PYTHON3_PKG_SETUP_DIR:=py-smbus - define Package/libi2c/install $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_BUILD_DIR)/lib/libi2c.so* $(1)/usr/lib/ From 81e99fa7ffd5439e8fbba5b34a13f80c0e20ea48 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 17 Apr 2020 22:35:31 +0800 Subject: [PATCH 12/13] seafile: Remove Python variants, update Python packaging This removes Python build variants and adds PYTHON3_PKG_BUILD:=0 (where appropriate) for the Seafile packages. This also updates the way the Python bindings packages are packaged, using automake installation instead of manual install recipes. Signed-off-by: Jeffery To --- libs/libsearpc/Makefile | 16 ++++++---------- .../patches/001-no-python-compile.patch | 8 ++++++++ net/seafile-ccnet/Makefile | 13 +++++-------- .../patches/011-no-python-compile.patch | 6 ++++++ net/seafile-seahub/Makefile | 9 +++++---- net/seafile-server/Makefile | 17 ++++------------- .../012-automake-no-python-compile.patch | 14 ++++++++++++++ 7 files changed, 48 insertions(+), 35 deletions(-) create mode 100644 libs/libsearpc/patches/001-no-python-compile.patch create mode 100644 net/seafile-ccnet/patches/011-no-python-compile.patch create mode 100644 net/seafile-server/patches/012-automake-no-python-compile.patch diff --git a/libs/libsearpc/Makefile b/libs/libsearpc/Makefile index 2183b8a47..e084e4eb1 100644 --- a/libs/libsearpc/Makefile +++ b/libs/libsearpc/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libsearpc PKG_VERSION:=3.2.0 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/haiwen/libsearpc.git @@ -25,6 +25,7 @@ PKG_FIXUP:=autoreconf PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 +PYTHON3_PKG_BUILD:=0 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/nls.mk @@ -50,19 +51,21 @@ define Package/python3-searpc SUBMENU:=Python TITLE:=Python bindings for Searpc DEPENDS:=+libsearpc +python3-light +python3-logging - VARIANT:=python3 endef define Package/python3-searpc/description $(call Package/libsearpc/description) - This package contains the Python bindings for Searpc. + This package contains Python bindings for Searpc. endef CONFIGURE_ARGS += \ --disable-compile-demo \ --disable-server-pkg +CONFIGURE_VARS += \ + PYTHON="$(HOST_PYTHON3_BIN)" + define Build/InstallDev $(INSTALL_DIR) $(1)/usr/{bin,include} $(INSTALL_DIR) $(1)/usr/lib/pkgconfig @@ -77,13 +80,6 @@ define Package/libsearpc/install $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsearpc.so* $(1)/usr/lib/ endef -define Py3Build/Compile - rm -rf $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/pysearpc - $(INSTALL_DIR) $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/pysearpc - $(INSTALL_DATA) $(PKG_BUILD_DIR)/pysearpc/*.py $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/pysearpc/ - rm -f $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/pysearpc/{pygencode,test_pysearpc}.py -endef - Py3Package/python3-searpc/install:=: $(eval $(call BuildPackage,libsearpc)) diff --git a/libs/libsearpc/patches/001-no-python-compile.patch b/libs/libsearpc/patches/001-no-python-compile.patch new file mode 100644 index 000000000..fc9120b0f --- /dev/null +++ b/libs/libsearpc/patches/001-no-python-compile.patch @@ -0,0 +1,8 @@ +--- a/pysearpc/Makefile.am ++++ b/pysearpc/Makefile.am +@@ -1,4 +1,4 @@ + + pysearpcdir=${pyexecdir}/pysearpc + +-pysearpc_PYTHON = __init__.py client.py common.py errors.py named_pipe.py server.py transport.py utils.py ++pysearpc_DATA = __init__.py client.py common.py errors.py named_pipe.py server.py transport.py utils.py diff --git a/net/seafile-ccnet/Makefile b/net/seafile-ccnet/Makefile index 0d76f01ab..a22883d3d 100644 --- a/net/seafile-ccnet/Makefile +++ b/net/seafile-ccnet/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=seafile-ccnet PKG_VERSION:=7.1.3 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/haiwen/ccnet-server/tar.gz/v$(PKG_VERSION)-server? @@ -25,6 +25,7 @@ PKG_BUILD_DEPENDS:=vala/host PKG_FIXUP:=autoreconf PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 +PYTHON3_PKG_BUILD:=0 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/nls.mk @@ -58,7 +59,6 @@ define Package/python3-seafile-ccnet SUBMENU:=Python TITLE:=Python bindings for Seafile Ccnet DEPENDS:=+seafile-ccnet +python3-light +python3-searpc - VARIANT:=python3 endef define Package/python3-seafile-ccnet/description @@ -73,6 +73,9 @@ CONFIGURE_ARGS += \ --enable-python \ --with-mysql="$(STAGING_DIR)/usr/bin/mysql_config" +CONFIGURE_VARS += \ + PYTHON="$(HOST_PYTHON3_BIN)" + define Package/seafile-ccnet/install $(INSTALL_DIR) $(1)/usr/{lib,libexec} $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/libexec/ @@ -88,12 +91,6 @@ define Build/InstallDev $(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.{a,la,so*} $(1)/usr/lib/ endef -define Py3Build/Compile - rm -rf $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/ccnet - $(INSTALL_DIR) $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/ccnet - $(INSTALL_DATA) $(PKG_BUILD_DIR)/python/ccnet/*.py $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/ccnet/ -endef - Py3Package/python3-seafile-ccnet/install:=: $(eval $(call BuildPackage,seafile-ccnet)) diff --git a/net/seafile-ccnet/patches/011-no-python-compile.patch b/net/seafile-ccnet/patches/011-no-python-compile.patch new file mode 100644 index 000000000..276b4992b --- /dev/null +++ b/net/seafile-ccnet/patches/011-no-python-compile.patch @@ -0,0 +1,6 @@ +--- a/python/ccnet/Makefile.am ++++ b/python/ccnet/Makefile.am +@@ -1,2 +1,2 @@ + ccnetdir=${pyexecdir}/ccnet +-ccnet_PYTHON = __init__.py rpc.py ++ccnet_DATA = __init__.py rpc.py diff --git a/net/seafile-seahub/Makefile b/net/seafile-seahub/Makefile index 295c7f9f9..d72a2a3bb 100644 --- a/net/seafile-seahub/Makefile +++ b/net/seafile-seahub/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=seafile-seahub PKG_VERSION:=7.1.3 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/haiwen/seahub/tar.gz/v$(PKG_VERSION)-server? @@ -24,6 +24,7 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/seahub-$(PKG_VERSION)-server HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:="Django~=1.11" PKG_BUILD_PARALLEL:=1 +PYTHON3_PKG_BUILD:=0 include $(INCLUDE_DIR)/package.mk include ../../lang/python/python3-package.mk @@ -57,7 +58,6 @@ define Package/seafile-seahub +python3-requests-oauthlib \ +python3-seafile-ccnet \ +python3-searpc - VARIANT:=python3 endef define Package/seafile-seahub/description @@ -75,10 +75,9 @@ MAKE_VARS += \ PYTHON="$(HOST_PYTHON3_BIN)" \ DJANGO_ADMIN_PY="$(STAGING_DIR_HOSTPKG)/bin/django-admin" -define Py3Build/Compile +define Build/Compile $(call HostPython3/PipInstall,$(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS)) $(call Build/Compile/Default,locale) - $(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR) endef define Py3Package/seafile-seahub/install @@ -90,6 +89,8 @@ define Py3Package/seafile-seahub/install mv $(1)/usr/share/seafile/seafile-server/seahub/media/avatars $(1)/usr/share/seafile/seafile-server/seahub/media/avatars_default endef +Py3Package/seafile-seahub/filespec:= + $(eval $(call Py3Package,seafile-seahub)) $(eval $(call BuildPackage,seafile-seahub)) $(eval $(call BuildPackage,seafile-seahub-src)) diff --git a/net/seafile-server/Makefile b/net/seafile-server/Makefile index d8c1901da..43cfa9b73 100644 --- a/net/seafile-server/Makefile +++ b/net/seafile-server/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=seafile-server PKG_VERSION:=7.1.3 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/haiwen/seafile-server/tar.gz/v$(PKG_VERSION)-server? @@ -25,6 +25,7 @@ PKG_BUILD_DEPENDS:=vala/host libevhtp PKG_FIXUP:=autoreconf PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 +PYTHON3_PKG_BUILD:=0 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/nls.mk @@ -111,7 +112,6 @@ define Package/python3-seafile-server SUBMENU:=Python TITLE:=Python bindings for Seafile server DEPENDS:=+python3-light +python3-logging +python3-searpc +python3-seafile-ccnet - VARIANT:=python3 endef define Package/python3-seafile-server/description @@ -126,10 +126,8 @@ CONFIGURE_ARGS += \ --enable-python \ --with-mysql="$(STAGING_DIR)/usr/bin/mysql_config" -# This is required as python3-package.mk overrides the default setting of having interlinking enabled -ifdef CONFIG_USE_MIPS16 - TARGET_CFLAGS += -minterlink-mips16 -endif +CONFIGURE_VARS += \ + PYTHON="$(HOST_PYTHON3_BIN)" ifdef CONFIG_GCC_LIBSSP TARGET_LDFLAGS += -lssp @@ -199,13 +197,6 @@ define Build/InstallDev $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libseafile.pc $(1)/usr/lib/pkgconfig/ endef -define Py3Build/Compile - rm -rf $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/{seafile,seaserv} - $(INSTALL_DIR) $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/{seafile,seaserv} - $(INSTALL_DATA) $(PKG_BUILD_DIR)/python/seafile/*.py $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/seafile/ - $(INSTALL_DATA) $(PKG_BUILD_DIR)/python/seaserv/*.py $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/seaserv/ -endef - define Package/seafile-server-fuse/install $(INSTALL_DIR) $(1)/usr/{bin,libexec} $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/seaf-fuse $(1)/usr/libexec/ diff --git a/net/seafile-server/patches/012-automake-no-python-compile.patch b/net/seafile-server/patches/012-automake-no-python-compile.patch new file mode 100644 index 000000000..624c8c7c5 --- /dev/null +++ b/net/seafile-server/patches/012-automake-no-python-compile.patch @@ -0,0 +1,14 @@ +--- a/python/seafile/Makefile.am ++++ b/python/seafile/Makefile.am +@@ -1,3 +1,3 @@ + seafiledir=${pyexecdir}/seafile + +-seafile_PYTHON = __init__.py rpcclient.py ++seafile_DATA = __init__.py rpcclient.py +--- a/python/seaserv/Makefile.am ++++ b/python/seaserv/Makefile.am +@@ -1,3 +1,3 @@ + seaservdir=${pyexecdir}/seaserv + +-seaserv_PYTHON = __init__.py service.py api.py ++seaserv_DATA = __init__.py service.py api.py From 89ae10ed715ee8ccbbf38c1e723e09a77ad8efff Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 17 Apr 2020 23:47:25 +0800 Subject: [PATCH 13/13] python3: Change PYTHON_VERSION references to PYTHON3_VERSION PYTHON_VERSION is a holdover from Python 2; all Python 3 variables are prefixed with PYTHON3 (or some variation with "3"). This updates all uses of PYTHON_VERSION to PYTHON3_VERSION. This also sets PYTHON3_PKG_BUILD:=0 before python3-package.mk is included in the python3 Makefile. Signed-off-by: Jeffery To --- lang/python/python3/Makefile | 98 +++++++++---------- .../python3/files/python3-package-dev.mk | 6 +- 2 files changed, 51 insertions(+), 53 deletions(-) diff --git a/lang/python/python3/Makefile b/lang/python/python3/Makefile index 989cf029d..627a1d3a6 100644 --- a/lang/python/python3/Makefile +++ b/lang/python/python3/Makefile @@ -7,15 +7,12 @@ include $(TOPDIR)/rules.mk -# The file included below defines PYTHON_VERSION +# The file included below defines PYTHON3_VERSION include ../python3-version.mk -PYTHON_VERSION:=$(PYTHON3_VERSION) -PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO) - PKG_NAME:=python3 PKG_RELEASE:=2 -PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO) +PKG_VERSION:=$(PYTHON3_VERSION).$(PYTHON3_VERSION_MICRO) PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION) @@ -30,6 +27,7 @@ PKG_CPE_ID:=cpe:/a:python:python include ../python3-host.mk # For Py3Package +PYTHON3_PKG_BUILD:=0 include ../python3-package.mk PKG_FIXUP:=autoreconf @@ -55,7 +53,7 @@ define Package/python3/Default SUBMENU:=Python SECTION:=lang CATEGORY:=Languages - TITLE:=Python $(PYTHON_VERSION) programming language + TITLE:=Python $(PYTHON3_VERSION) programming language URL:=https://www.python.org/ endef @@ -70,7 +68,7 @@ endef define Package/python3-base $(call Package/python3/Default) - TITLE:=Python $(PYTHON_VERSION) interpreter + TITLE:=Python $(PYTHON3_VERSION) interpreter DEPENDS:=+libpthread +zlib endef @@ -81,7 +79,7 @@ endef define Package/python3-light $(call Package/python3/Default) - TITLE:=Python $(PYTHON_VERSION) light installation + TITLE:=Python $(PYTHON3_VERSION) light installation DEPENDS:=+python3-base +libffi +libbz2 +PYTHON3_BLUETOOTH_SUPPORT:bluez-libs +libuuid endef @@ -108,8 +106,8 @@ define Py3BasePackage define Py3Package/$(1)/filespec ifneq ($(2),) $(subst $(space),$(newline),$(foreach lib_file,$(2),+|$(lib_file))) - -|/usr/lib/python$(PYTHON_VERSION)/*/test - -|/usr/lib/python$(PYTHON_VERSION)/*/tests + -|/usr/lib/python$(PYTHON3_VERSION)/*/test + -|/usr/lib/python$(PYTHON3_VERSION)/*/tests endif endef Py3Package/$(1)/install?=: @@ -144,7 +142,7 @@ endif PYTHON_FOR_BUILD:= \ _PYTHON_PROJECT_BASE=$(PKG_BUILD_DIR) \ _PYTHON_HOST_PLATFORM=linux2 \ - PYTHONPATH="$(PKG_BUILD_DIR)/Lib:$(PKG_BUILD_DIR)/build/lib.linux2-$(PYTHON_VERSION)" \ + PYTHONPATH="$(PKG_BUILD_DIR)/Lib:$(PKG_BUILD_DIR)/build/lib.linux2-$(PYTHON3_VERSION)" \ _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata \ $(HOST_PYTHON3_BIN) @@ -218,72 +216,72 @@ define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig $(INSTALL_DIR) $(2)/bin $(CP) \ - $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \ + $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON3_VERSION) \ $(1)/usr/include/ $(CP) \ - $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION) \ - $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* \ + $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON3_VERSION) \ + $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON3_VERSION).so* \ $(1)/usr/lib/ $(CP) \ $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/python*.pc \ $(1)/usr/lib/pkgconfig $(INSTALL_BIN) \ - $(PKG_INSTALL_DIR)/usr/bin/python$(PYTHON_VERSION)-config \ + $(PKG_INSTALL_DIR)/usr/bin/python$(PYTHON3_VERSION)-config \ $(2)/bin/ $(SED) \ 's|^prefix_real=.*$$$$|prefix_real="$(PYTHON3_DIR)"|' \ - $(2)/bin/python$(PYTHON_VERSION)-config + $(2)/bin/python$(PYTHON3_VERSION)-config endef PYTHON3_BASE_LIB_FILES:= \ - /usr/lib/python$(PYTHON_VERSION)/encodings \ - /usr/lib/python$(PYTHON_VERSION)/_collections_abc.py \ - /usr/lib/python$(PYTHON_VERSION)/_sitebuiltins.py \ - /usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py \ - /usr/lib/python$(PYTHON_VERSION)/_weakrefset.py \ - /usr/lib/python$(PYTHON_VERSION)/abc.py \ - /usr/lib/python$(PYTHON_VERSION)/codecs.py \ - /usr/lib/python$(PYTHON_VERSION)/genericpath.py \ - /usr/lib/python$(PYTHON_VERSION)/io.py \ - /usr/lib/python$(PYTHON_VERSION)/os.py \ - /usr/lib/python$(PYTHON_VERSION)/posixpath.py \ - /usr/lib/python$(PYTHON_VERSION)/site.py \ - /usr/lib/python$(PYTHON_VERSION)/sysconfig.py \ - /usr/lib/python$(PYTHON_VERSION)/stat.py + /usr/lib/python$(PYTHON3_VERSION)/encodings \ + /usr/lib/python$(PYTHON3_VERSION)/_collections_abc.py \ + /usr/lib/python$(PYTHON3_VERSION)/_sitebuiltins.py \ + /usr/lib/python$(PYTHON3_VERSION)/_sysconfigdata.py \ + /usr/lib/python$(PYTHON3_VERSION)/_weakrefset.py \ + /usr/lib/python$(PYTHON3_VERSION)/abc.py \ + /usr/lib/python$(PYTHON3_VERSION)/codecs.py \ + /usr/lib/python$(PYTHON3_VERSION)/genericpath.py \ + /usr/lib/python$(PYTHON3_VERSION)/io.py \ + /usr/lib/python$(PYTHON3_VERSION)/os.py \ + /usr/lib/python$(PYTHON3_VERSION)/posixpath.py \ + /usr/lib/python$(PYTHON3_VERSION)/site.py \ + /usr/lib/python$(PYTHON3_VERSION)/sysconfig.py \ + /usr/lib/python$(PYTHON3_VERSION)/stat.py PYTHON3_LIB_FILES_DEL+=$(PYTHON3_BASE_LIB_FILES) define Py3Package/python3-base/filespec -+|/usr/bin/python$(PYTHON_VERSION) ++|/usr/bin/python$(PYTHON3_VERSION) $(subst $(space),$(newline),$(foreach lib_file,$(PYTHON3_BASE_LIB_FILES),+|$(lib_file))) endef define Py3Package/python3-light/filespec -+|/usr/lib/python$(PYTHON_VERSION) --|/usr/lib/python$(PYTHON_VERSION)/distutils/cygwinccompiler.py --|/usr/lib/python$(PYTHON_VERSION)/distutils/command/wininst* --|/usr/lib/python$(PYTHON_VERSION)/ensurepip --|/usr/lib/python$(PYTHON_VERSION)/idlelib --|/usr/lib/python$(PYTHON_VERSION)/tkinter --|/usr/lib/python$(PYTHON_VERSION)/turtledemo --|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_test*.so --|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/readline*.so --|/usr/lib/python$(PYTHON_VERSION)/pdb.doc --|/usr/lib/python$(PYTHON_VERSION)/test --|/usr/lib/python$(PYTHON_VERSION)/webbrowser.py --|/usr/lib/python$(PYTHON_VERSION)/*/test --|/usr/lib/python$(PYTHON_VERSION)/*/tests --|/usr/lib/python$(PYTHON_VERSION)/_osx_support.py ++|/usr/lib/python$(PYTHON3_VERSION) +-|/usr/lib/python$(PYTHON3_VERSION)/distutils/cygwinccompiler.py +-|/usr/lib/python$(PYTHON3_VERSION)/distutils/command/wininst* +-|/usr/lib/python$(PYTHON3_VERSION)/ensurepip +-|/usr/lib/python$(PYTHON3_VERSION)/idlelib +-|/usr/lib/python$(PYTHON3_VERSION)/tkinter +-|/usr/lib/python$(PYTHON3_VERSION)/turtledemo +-|/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_test*.so +-|/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/readline*.so +-|/usr/lib/python$(PYTHON3_VERSION)/pdb.doc +-|/usr/lib/python$(PYTHON3_VERSION)/test +-|/usr/lib/python$(PYTHON3_VERSION)/webbrowser.py +-|/usr/lib/python$(PYTHON3_VERSION)/*/test +-|/usr/lib/python$(PYTHON3_VERSION)/*/tests +-|/usr/lib/python$(PYTHON3_VERSION)/_osx_support.py $(subst $(space),$(newline),$(foreach lib_file,$(PYTHON3_LIB_FILES_DEL),-|$(lib_file))) endef define Py3Package/python3-base/install # Adding the lib-dynload folder (even just empty) suppresses 2 warnings when starting Python - $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/lib-dynload/ + $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/ $(INSTALL_DIR) $(1)/usr/bin - $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python3 - $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* $(1)/usr/lib/ + $(LN) python$(PYTHON3_VERSION) $(1)/usr/bin/python3 + $(LN) python$(PYTHON3_VERSION) $(1)/usr/bin/python + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON3_VERSION).so* $(1)/usr/lib/ endef Py3Package/python3-light/install:=: diff --git a/lang/python/python3/files/python3-package-dev.mk b/lang/python/python3/files/python3-package-dev.mk index 642bb0b5f..12ceceab7 100644 --- a/lang/python/python3/files/python3-package-dev.mk +++ b/lang/python/python3/files/python3-package-dev.mk @@ -15,12 +15,12 @@ define Py3Package/python3-dev/install $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/bin/python$(PYTHON3_VERSION)-config $(1)/usr/bin $(LN) python$(PYTHON3_VERSION)-config $(1)/usr/bin/python3-config - $(LN) python$(PYTHON_VERSION)/config-$(PYTHON_VERSION)/libpython$(PYTHON3_VERSION).a $(1)/usr/lib/ + $(LN) python$(PYTHON3_VERSION)/config-$(PYTHON3_VERSION)/libpython$(PYTHON3_VERSION).a $(1)/usr/lib/ endef $(eval $(call Py3BasePackage,python3-dev, \ - /usr/lib/python$(PYTHON_VERSION)/config-$(PYTHON_VERSION) \ - /usr/include/python$(PYTHON_VERSION) \ + /usr/lib/python$(PYTHON3_VERSION)/config-$(PYTHON3_VERSION) \ + /usr/include/python$(PYTHON3_VERSION) \ /usr/lib/pkgconfig \ , \ DO_NOT_ADD_TO_PACKAGE_DEPENDS \