diff options
author | Hannu Nyman <hannu.nyman@iki.fi> | 2020-04-20 20:05:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-20 20:05:07 +0300 |
commit | 6c2235253fc8057421c7c0b58e91c5eff07b407e (patch) | |
tree | 45ae98f0d1d8279f83683d4b735f00b6f7dd67b3 /lang | |
parent | e40f92c90dbed675d2f1555f65e3d25d9a9aad5a (diff) | |
parent | 89ae10ed715ee8ccbbf38c1e723e09a77ad8efff (diff) |
Merge pull request #11872 from jefferyto/python3-makefile-cleanup
python3: Makefile cleanup
Diffstat (limited to 'lang')
-rw-r--r-- | lang/python/gunicorn/Makefile | 2 | ||||
-rw-r--r-- | lang/python/python-gnupg/Makefile | 2 | ||||
-rw-r--r-- | lang/python/python-lxml/Makefile | 2 | ||||
-rw-r--r-- | lang/python/python-package-install.sh | 56 | ||||
-rw-r--r-- | lang/python/python-six/Makefile | 2 | ||||
-rw-r--r-- | lang/python/python3-host.mk | 60 | ||||
-rw-r--r-- | lang/python/python3-package.mk | 202 | ||||
-rw-r--r-- | lang/python/python3-packages/Makefile | 6 | ||||
-rw-r--r-- | lang/python/python3/Makefile | 98 | ||||
-rw-r--r-- | lang/python/python3/files/python3-package-dev.mk | 6 |
10 files changed, 209 insertions, 227 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/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/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 403d0d282..81b0025b1 100644 --- a/lang/python/python3-host.mk +++ b/lang/python/python3-host.mk @@ -5,12 +5,9 @@ # 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 -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 @@ -25,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)" \ @@ -51,30 +32,27 @@ 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 \ - ) +define HostPython3/Run + 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); HOST_PYTHON3_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON3_VERSION) # $(1) => packages to install -define Build/Compile/HostPy3PipInstall - $(call host_python3_settings) \ +define HostPython3/PipInstall + $(HOST_PYTHON3_VARS) \ $(HOST_PYTHON3_PIP) \ --disable-pip-version-check \ --cache-dir "$(DL_DIR)/pip-cache" \ @@ -85,11 +63,9 @@ endef # $(1) => build subdir # $(2) => additional arguments to setup.py # $(3) => additional variables -define Build/Compile/HostPy3Mod - $(call Build/Compile/HostPy3RunHost, \ - cd $(HOST_BUILD_DIR)/$(strip $(1)), \ - ./setup.py $(2), \ +define HostPython3/ModSetup + $(call HostPython3/Run, \ + $(HOST_BUILD_DIR)/$(strip $(1)), \ + setup.py $(2), \ $(3)) endef - -endif # __python3_host_mk_inc diff --git a/lang/python/python3-package.mk b/lang/python/python3-package.mk index 97589b563..b16773263 100644 --- a/lang/python/python3-package.mk +++ b/lang/python/python3-package.mk @@ -5,12 +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) @@ -27,19 +27,106 @@ 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)" \ + 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" -define Py3Shebang -$(SED) "1"'!'"b;s,^#"'!'".*python.*,#"'!'"/usr/bin/python3," -i --follow-symlinks $(1) +# $(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 -define Py3Package +# $(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 + +# 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 + +# 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 $(call Package/$(1)) DEPENDS:= @@ -52,8 +139,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 @@ -61,73 +149,43 @@ 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 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 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" \ - "$(PKG_INSTALL_DIR)" "$$(1)" \ - "$(HOST_PYTHON3_BIN)" "$$(2)" \ - "$$$$$$$$$$(call shvar,Py3Package/$(1)/filespec)" && \ - if [ -d "$$(1)/usr/bin" ]; then \ - $(call Py3Shebang,$$(1)/usr/bin/*) ; \ + $$(call Py3Package/ProcessFilespec,$(1),$(PKG_INSTALL_DIR),$$(1)) + $(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)) + $$(call Py3Package/ProcessFilespec,$(1),$(PKG_INSTALL_DIR),$$(1)) + $$(call Python3/DeleteNonSourceFiles,$$(1)) + $$(call Python3/DeleteEmptyDirs,$$(1)) + endef endif # Package/$(1)/install endef -# $(1) => commands to execute before running pythons 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) \ - ) -endef -# $(1) => build subdir -# $(2) => additional arguments to setup.py -# $(3) => additional variables -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), \ - $(3)) -endef +# Py3Build PYTHON3_PKG_SETUP_DIR ?= PYTHON3_PKG_SETUP_GLOBAL_ARGS ?= @@ -136,9 +194,9 @@ 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, \ + $(call Python3/ModSetup, \ $(PYTHON3_PKG_SETUP_DIR), \ $(PYTHON3_PKG_SETUP_GLOBAL_ARGS) \ install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \ @@ -149,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 diff --git a/lang/python/python3-packages/Makefile b/lang/python/python3-packages/Makefile index e3c8f6225..b1b37dac0 100644 --- a/lang/python/python3-packages/Makefile +++ b/lang/python/python3-packages/Makefile @@ -101,13 +101,13 @@ 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)) + $(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/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 \ |