From 2dfdef66a383a0db10d9746a21a9362f18502fe9 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Thu, 9 Apr 2020 19:20:48 +0800 Subject: 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(-) (limited to 'lang') 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 -- cgit v1.2.3 From 3642b18441a386e0af2b5912b2d823f7b4dd7939 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Thu, 9 Apr 2020 22:42:27 +0800 Subject: 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(-) (limited to 'lang') 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) \ -- cgit v1.2.3 From 87b8f45230c59d2b4c90ee0a2caaa5a22bf3d77a Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Thu, 9 Apr 2020 23:02:14 +0800 Subject: 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(-) (limited to 'lang') 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 -- cgit v1.2.3 From fc8387614ccd919e5c2308d61924fb5a994c83c5 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Thu, 9 Apr 2020 23:28:07 +0800 Subject: 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(-) (limited to 'lang') 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" \ -- cgit v1.2.3 From 0bc1bf55781e31a3513a6a6269f1003b4344d04e Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 10 Apr 2020 22:22:58 +0800 Subject: 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(-) (limited to 'lang') 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 ?= -- cgit v1.2.3 From 3cdca38dce01553766b032d8bbfce08a35d6555e Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 14 Apr 2020 21:14:49 +0800 Subject: 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(-) (limited to 'lang') 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 -- cgit v1.2.3 From c9b260f5ae9aee3de15f704ee454acfdef4c7579 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 15 Apr 2020 15:11:01 +0800 Subject: 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(-) (limited to 'lang') 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 -- cgit v1.2.3 From ba127c155a104be0a93c6f85877db0d6f27ba9df Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 15 Apr 2020 21:55:17 +0800 Subject: 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(-) (limited to 'lang') 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 -- cgit v1.2.3 From 58719a3c4bd75479f992982bef3b77fef8310726 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 15 Apr 2020 21:58:40 +0800 Subject: 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(-) (limited to 'lang') 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)" \ -- cgit v1.2.3 From 9636f6f4477c228e0b3c23f4082b53ab7c61f3ce Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 17 Apr 2020 22:09:32 +0800 Subject: 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(-) (limited to 'lang') 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 -- cgit v1.2.3 From 89ae10ed715ee8ccbbf38c1e723e09a77ad8efff Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 17 Apr 2020 23:47:25 +0800 Subject: 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 ++++++++++++------------ lang/python/python3/files/python3-package-dev.mk | 6 +- 2 files changed, 51 insertions(+), 53 deletions(-) (limited to 'lang') 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 \ -- cgit v1.2.3