aboutsummaryrefslogtreecommitdiff
path: root/lang/python/python3
diff options
context:
space:
mode:
authorAlexandru Ardelean <ardeleanalex@gmail.com>2017-05-17 16:45:48 +0300
committerAlexandru Ardelean <ardeleanalex@gmail.com>2017-05-17 16:51:14 +0300
commit68312f49c0b4456e665ed438a86a44738caa765a (patch)
tree6280a9fb0de5782ca8ca4ca39b014062e1b8d387 /lang/python/python3
parent1bf7af4ca53db6f58655857f6eb49a9893c854d9 (diff)
python packages: move all things python under lang/python
I admit this may be be a bit aggressive, but the lang folder is getting cluttered/filled up with Python, PHP, Perl, Ruby, etc. packages. Makes sense to try to group them into per-lang folders. I took the Pythons. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Diffstat (limited to 'lang/python/python3')
-rw-r--r--lang/python/python3/Makefile305
-rw-r--r--lang/python/python3/files/config.site12
-rw-r--r--lang/python/python3/files/python3-host.mk81
-rw-r--r--lang/python/python3/files/python3-package-asyncio.mk16
-rw-r--r--lang/python/python3/files/python3-package-codecs.mk22
-rw-r--r--lang/python/python3/files/python3-package-ctypes.mk18
-rw-r--r--lang/python/python3/files/python3-package-dbm.mk17
-rw-r--r--lang/python/python3/files/python3-package-decimal.mk17
-rw-r--r--lang/python/python3/files/python3-package-dev.mk27
-rw-r--r--lang/python/python3/files/python3-package-distutils.mk16
-rw-r--r--lang/python/python3/files/python3-package-email.mk16
-rw-r--r--lang/python/python3/files/python3-package-gdbm.mk16
-rw-r--r--lang/python/python3/files/python3-package-install.sh69
-rw-r--r--lang/python/python3/files/python3-package-lib2to3.mk18
-rw-r--r--lang/python/python3/files/python3-package-logging.mk16
-rw-r--r--lang/python/python3/files/python3-package-lzma.mk17
-rw-r--r--lang/python/python3/files/python3-package-multiprocessing.mk17
-rw-r--r--lang/python/python3/files/python3-package-ncurses.mk18
-rw-r--r--lang/python/python3/files/python3-package-openssl.mk17
-rw-r--r--lang/python/python3/files/python3-package-pip.mk28
-rw-r--r--lang/python/python3/files/python3-package-pydoc.mk18
-rw-r--r--lang/python/python3/files/python3-package-setuptools.mk31
-rw-r--r--lang/python/python3/files/python3-package-sqlite3.mk17
-rw-r--r--lang/python/python3/files/python3-package-unittest.mk16
-rw-r--r--lang/python/python3/files/python3-package-xml.mk19
-rw-r--r--lang/python/python3/files/python3-package.mk137
-rw-r--r--lang/python/python3/files/python3-version.mk17
-rw-r--r--lang/python/python3/patches/001-enable-zlib.patch25
-rw-r--r--lang/python/python3/patches/003-do-not-run-distutils-tests.patch46
-rw-r--r--lang/python/python3/patches/004-do-not-write-bytes-codes.patch22
-rw-r--r--lang/python/python3/patches/006-remove-debian-multiarch-support.patch12
-rw-r--r--lang/python/python3/patches/007-distutils-do-not-adjust-path.patch10
-rw-r--r--lang/python/python3/patches/010-do-not-add-rt-lib-dirs-when-cross-compiling.patch15
-rw-r--r--lang/python/python3/patches/011-fix-ncursesw-definition-colisions.patch12
-rw-r--r--lang/python/python3/patches/012-disable-wcsftime-detection.patch13
-rw-r--r--lang/python/python3/patches/014-remove-platform-so-suffix.patch26
-rw-r--r--lang/python/python3/patches/015-abort-on-failed-modules.patch12
-rw-r--r--lang/python/python3/patches/016-adjust-config-paths.patch72
38 files changed, 1283 insertions, 0 deletions
diff --git a/lang/python/python3/Makefile b/lang/python/python3/Makefile
new file mode 100644
index 000000000..584dcbb5f
--- /dev/null
+++ b/lang/python/python3/Makefile
@@ -0,0 +1,305 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+# The file included below defines PYTHON_VERSION
+include ./files/python3-version.mk
+
+PYTHON_VERSION:=$(PYTHON3_VERSION)
+PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO)
+
+PKG_NAME:=python3
+PKG_RELEASE:=1
+PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
+
+PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION)
+PKG_MD5SUM:=692b4fc3a2ba0d54d1495d4ead5b0b5c
+PKG_HASH:=a01810ddfcec216bcdb357a84bfaafdfaa0ca42bbdaa4cb7ff74f5a9961e4041
+
+PKG_LICENSE:=PSF
+PKG_LICENSE_FILES:=LICENSE Modules/_ctypes/libffi_msvc/LICENSE Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi/LICENSE Modules/_ctypes/libffi_osx/LICENSE Tools/pybench/LICENSE
+
+# This file provides the necsessary host build variables
+include ./files/python3-host.mk
+
+# For Py3Package
+include ./files/python3-package.mk
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+HOST_BUILD_PARALLEL:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
+
+PKG_BUILD_DEPENDS:=python3/host
+HOST_BUILD_DEPENDS:=bzip2/host expat/host libffi/host
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/python3/Default
+ SUBMENU:=Python
+ SECTION:=lang
+ CATEGORY:=Languages
+ TITLE:=Python $(PYTHON_VERSION) programming language
+ URL:=https://www.python.org/
+ MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
+endef
+
+define Package/python3/Default/description
+ Python is a dynamic object-oriented programming language that can be used
+ for many kinds of software development. It offers strong support for
+ integration with other languages and tools, comes with extensive standard
+ libraries, and can be learned in a few days. Many Python programmers
+ report substantial productivity gains and feel the language encourages
+ the development of higher quality, more maintainable code.
+endef
+
+define Package/python3-base
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON_VERSION) interpreter
+ DEPENDS:=+libpthread +zlib
+endef
+
+define Package/python3-base/description
+ This package contains only the interpreter and the bare minimum
+ for the interpreter to start.
+endef
+
+define Package/python3-light
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON_VERSION) light installation
+ DEPENDS:=+python3-base +libffi +libbz2
+endef
+
+define Package/python3-light/description
+ This package is essentially the python3-base package plus
+ a few of the rarely used (and big) libraries stripped out
+ into separate packages.
+endef
+
+PYTHON3_LIB_FILES_DEL:=
+PYTHON3_PACKAGES:=
+PYTHON3_SO_SUFFIX:=cpython-$(PYTHON3_VERSION_MAJOR)$(PYTHON3_VERSION_MINOR).so
+PYTHON3_PACKAGES_DEPENDS:=
+define Py3BasePackage
+ PYTHON3_PACKAGES+=$(1)
+ ifeq ($(3),)
+ PYTHON3_PACKAGES_DEPENDS+=$(1)
+ endif
+ PYTHON3_LIB_FILES_DEL+=$(2)
+ 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
+ endif
+ endef
+endef
+
+include ./files/python3-package-*.mk
+
+define Package/python3
+$(call Package/python3/Default)
+ DEPENDS:=+python3-light $(foreach package,$(PYTHON3_PACKAGES_DEPENDS),+$(package))
+endef
+
+define Package/python3/description
+ This package contains the (almost) full Python install.
+ It's python3-light + all other packages.
+endef
+
+MAKE_FLAGS+=\
+ CROSS_COMPILE=yes \
+ LD="$(TARGET_CC)" \
+ PGEN=pgen3
+
+EXTRA_CFLAGS+= \
+ -DNDEBUG -fno-inline
+EXTRA_LDFLAGS+= \
+ -L$(PKG_BUILD_DIR)
+
+ENABLE_IPV6:=
+ifeq ($(CONFIG_IPV6),y)
+ ENABLE_IPV6 += --enable-ipv6
+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)" \
+ _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata \
+ $(HOST_PYTHON3_BIN)
+
+CONFIGURE_ARGS+= \
+ --sysconfdir=/etc \
+ --enable-shared \
+ --without-cxx-main \
+ --with-threads \
+ --with-system-ffi \
+ --with-ensurepip=no \
+ --without-pymalloc \
+ PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)" \
+ $(ENABLE_IPV6) \
+ CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
+ OPT="$(TARGET_CFLAGS)"
+
+define Build/Prepare
+ $(call Build/Prepare/Default)
+ $(CP) ./files/config.site $(PKG_BUILD_DIR)/config.site
+endef
+
+ifdef CONFIG_PACKAGE_python3-setuptools
+define Build/Compile/python3-setuptools
+ $(STAGING_DIR_HOSTPKG)/bin/pip3 install \
+ --ignore-installed \
+ --root=$(PKG_BUILD_DIR)/install-setuptools --prefix=. \
+ $(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/setuptools-*.whl
+endef
+endif # CONFIG_PACKAGE_python3-setuptools
+
+ifdef CONFIG_PACKAGE_python3-pip
+define Build/Compile/python3-pip
+ $(STAGING_DIR_HOSTPKG)/bin/pip3 install \
+ --ignore-installed \
+ --root=$(PKG_BUILD_DIR)/install-pip --prefix=. \
+ $(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/pip-*.whl
+endef
+endif # CONFIG_PACKAGE_python3-pip
+
+define Build/Compile
+ $(call Build/Compile/Default)
+ # Use host pip to install python-setuptools
+ $(call Build/Compile/python3-setuptools)
+ $(call Build/Compile/python3-pip)
+endef
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(STAGING_DIR)/mk/
+ $(INSTALL_DIR) $(1)/usr/include/ $(1)/usr/lib/
+ $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/
+ $(INSTALL_DATA) \
+ ./files/python3-package.mk \
+ ./files/python3-host.mk \
+ ./files/python3-version.mk \
+ ./files/python3-package-install.sh \
+ $(STAGING_DIR)/mk/
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
+ $(1)/usr/include/
+ $(CP) \
+ $(HOST_PYTHON3_LIB_DIR) \
+ $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* \
+ $(1)/usr/lib/
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config-$(PYTHON_VERSION) \
+ $(1)/usr/lib/python$(PYTHON_VERSION)/
+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
+
+PYTHON3_LIB_FILES_DEL+=$(PYTHON3_BASE_LIB_FILES)
+
+define Py3Package/python3-base/filespec
++|/usr/bin/python$(PYTHON_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
+$(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/bin
+ $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python3
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* $(1)/usr/lib/
+endef
+
+define Py3Package/python3/filespec
+-|$(PYTHON3_PKG_DIR)
+endef
+
+HOST_LDFLAGS += \
+ $$$$(pkg-config --static --libs libcrypto libssl)
+
+HOST_CONFIGURE_ARGS+= \
+ --without-cxx-main \
+ --without-pymalloc \
+ --with-threads \
+ --prefix=$(HOST_PYTHON3_DIR) \
+ --exec-prefix=$(HOST_PYTHON3_DIR) \
+ --with-system-expat=$(STAGING_DIR_HOSTPKG) \
+ --with-system-ffi=no \
+ --with-ensurepip=install \
+ CONFIG_SITE=
+
+define Host/Compile
+ +$(HOST_MAKE_VARS) $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) python Parser/pgen
+ +$(HOST_MAKE_VARS) $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) sharedmods
+endef
+
+define Host/Install
+ $(MAKE) -C $(HOST_BUILD_DIR) install
+
+ $(INSTALL_DIR) $(HOST_PYTHON3_DIR)/bin/
+ $(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(HOST_PYTHON3_DIR)/bin/pgen3
+ $(INSTALL_BIN) $(HOST_BUILD_DIR)/Programs/_freeze_importlib $(HOST_PYTHON3_DIR)/bin/_freeze_importlib
+endef
+
+$(eval $(call HostBuild))
+
+$(foreach package, $(PYTHON3_PACKAGES), \
+ $(eval $(call Py3Package,$(package))) \
+ $(eval $(call BuildPackage,$(package))) \
+ $(eval $(call BuildPackage,$(package)-src)) \
+)
+
+$(eval $(call Py3Package,python3-base))
+$(eval $(call Py3Package,python3-light))
+$(eval $(call Py3Package,python3))
+
+$(eval $(call BuildPackage,python3-base))
+$(eval $(call BuildPackage,python3-light))
+$(eval $(call BuildPackage,python3))
+
+$(eval $(call BuildPackage,python3-base-src))
+$(eval $(call BuildPackage,python3-light-src))
+$(eval $(call BuildPackage,python3-src))
diff --git a/lang/python/python3/files/config.site b/lang/python/python3/files/config.site
new file mode 100644
index 000000000..cfa56b89b
--- /dev/null
+++ b/lang/python/python3/files/config.site
@@ -0,0 +1,12 @@
+#! /bin/sh
+#
+# Copyright (C) 2007-2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+ac_cv_file__dev_ptmx=yes
+ac_cv_file__dev_ptc=no
+ac_cv_buggy_getaddrinfo=no
+
diff --git a/lang/python/python3/files/python3-host.mk b/lang/python/python3/files/python3-host.mk
new file mode 100644
index 000000000..3abf6aa5f
--- /dev/null
+++ b/lang/python/python3/files/python3-host.mk
@@ -0,0 +1,81 @@
+#
+# Copyright (C) 2017 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+ifneq ($(__python3_host_mk_inc),1)
+__python3_host_mk_inc=1
+
+# For PYTHON3_VERSION
+$(call include_mk, python3-version.mk)
+
+HOST_PYTHON3_DIR:=$(STAGING_DIR_HOSTPKG)
+HOST_PYTHON3_INC_DIR:=$(HOST_PYTHON3_DIR)/include/python$(PYTHON3_VERSION)
+HOST_PYTHON3_LIB_DIR:=$(HOST_PYTHON3_DIR)/lib/python$(PYTHON3_VERSION)
+
+HOST_PYTHON3_PKG_DIR:=$(HOST_PYTHON3_DIR)/lib/python$(PYTHON3_VERSION)/site-packages
+
+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
+
+# $(1) => commands to execute before running pythons script
+# $(2) => python script and its arguments
+# $(3) => additional variables
+define Build/Compile/HostPy3RunHost
+ $(call HostPython3, \
+ $(if $(1),$(1);) \
+ CC="$(HOSTCC)" \
+ CCSHARED="$(HOSTCC) $(HOST_FPIC)" \
+ CXX="$(HOSTCXX)" \
+ LD="$(HOSTCC)" \
+ LDSHARED="$(HOSTCC) -shared" \
+ 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 \
+ $(3) \
+ , \
+ $(2) \
+ , \
+ HOST \
+ )
+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), \
+ $(3))
+endef
+
+define HostPy3/Compile/Default
+ $(call Build/Compile/HostPy3Mod,,\
+ install --root="$(STAGING_DIR_HOSTPKG)" --prefix="" \
+ --single-version-externally-managed \
+ )
+endef
+
+endif # __python3_host_mk_inc
diff --git a/lang/python/python3/files/python3-package-asyncio.mk b/lang/python/python3/files/python3-package-asyncio.mk
new file mode 100644
index 000000000..52eccae92
--- /dev/null
+++ b/lang/python/python3/files/python3-package-asyncio.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-asyncio
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) asyncio module
+ DEPENDS:=+python3-light
+endef
+
+$(eval $(call Py3BasePackage,python3-asyncio, \
+ /usr/lib/python$(PYTHON3_VERSION)/asyncio \
+))
diff --git a/lang/python/python3/files/python3-package-codecs.mk b/lang/python/python3/files/python3-package-codecs.mk
new file mode 100644
index 000000000..f768b02ea
--- /dev/null
+++ b/lang/python/python3/files/python3-package-codecs.mk
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-codecs
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) codecs + unicode support
+ DEPENDS:=+python3-light
+endef
+
+$(eval $(call Py3BasePackage,python3-codecs, \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_cn.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_hk.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_iso2022.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_jp.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_kr.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_tw.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/unicodedata.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/lang/python/python3/files/python3-package-ctypes.mk b/lang/python/python3/files/python3-package-ctypes.mk
new file mode 100644
index 000000000..f38e0118c
--- /dev/null
+++ b/lang/python/python3/files/python3-package-ctypes.mk
@@ -0,0 +1,18 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-ctypes
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) ctypes module
+ DEPENDS:=+python3-light
+endef
+
+$(eval $(call Py3BasePackage,python3-ctypes, \
+ /usr/lib/python$(PYTHON3_VERSION)/ctypes \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_ctypes.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_ctypes_test.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/lang/python/python3/files/python3-package-dbm.mk b/lang/python/python3/files/python3-package-dbm.mk
new file mode 100644
index 000000000..409940229
--- /dev/null
+++ b/lang/python/python3/files/python3-package-dbm.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-dbm
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) dbm module
+ DEPENDS:=+python3-light +libdb47
+endef
+
+$(eval $(call Py3BasePackage,python3-dbm, \
+ /usr/lib/python$(PYTHON3_VERSION)/dbm \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_dbm.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/lang/python/python3/files/python3-package-decimal.mk b/lang/python/python3/files/python3-package-decimal.mk
new file mode 100644
index 000000000..391b6f659
--- /dev/null
+++ b/lang/python/python3/files/python3-package-decimal.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-decimal
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) decimal module
+ DEPENDS:=+python3-light
+endef
+
+$(eval $(call Py3BasePackage,python3-decimal, \
+ /usr/lib/python$(PYTHON3_VERSION)/decimal.py \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_decimal.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/lang/python/python3/files/python3-package-dev.mk b/lang/python/python3/files/python3-package-dev.mk
new file mode 100644
index 000000000..642bb0b5f
--- /dev/null
+++ b/lang/python/python3/files/python3-package-dev.mk
@@ -0,0 +1,27 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-dev
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) development files
+ DEPENDS:=+python3 +python3-lib2to3
+endef
+
+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/
+endef
+
+$(eval $(call Py3BasePackage,python3-dev, \
+ /usr/lib/python$(PYTHON_VERSION)/config-$(PYTHON_VERSION) \
+ /usr/include/python$(PYTHON_VERSION) \
+ /usr/lib/pkgconfig \
+ , \
+ DO_NOT_ADD_TO_PACKAGE_DEPENDS \
+))
diff --git a/lang/python/python3/files/python3-package-distutils.mk b/lang/python/python3/files/python3-package-distutils.mk
new file mode 100644
index 000000000..b1f1fb5c6
--- /dev/null
+++ b/lang/python/python3/files/python3-package-distutils.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-distutils
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) distutils module
+ DEPENDS:=+python3-light
+endef
+
+$(eval $(call Py3BasePackage,python3-distutils, \
+ /usr/lib/python$(PYTHON3_VERSION)/distutils \
+))
diff --git a/lang/python/python3/files/python3-package-email.mk b/lang/python/python3/files/python3-package-email.mk
new file mode 100644
index 000000000..6cf44071d
--- /dev/null
+++ b/lang/python/python3/files/python3-package-email.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-email
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) email module
+ DEPENDS:=+python3-light
+endef
+
+$(eval $(call Py3BasePackage,python3-email, \
+ /usr/lib/python$(PYTHON3_VERSION)/email \
+))
diff --git a/lang/python/python3/files/python3-package-gdbm.mk b/lang/python/python3/files/python3-package-gdbm.mk
new file mode 100644
index 000000000..7f98badf3
--- /dev/null
+++ b/lang/python/python3/files/python3-package-gdbm.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-gdbm
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) gdbm module
+ DEPENDS:=+python3-light +libgdbm
+endef
+
+$(eval $(call Py3BasePackage,python3-gdbm, \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_gdbm.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/lang/python/python3/files/python3-package-install.sh b/lang/python/python3/files/python3-package-install.sh
new file mode 100644
index 000000000..cc1005189
--- /dev/null
+++ b/lang/python/python3/files/python3-package-install.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+process_filespec() {
+ local src_dir="$1"
+ local dst_dir="$2"
+ local filespec="$3"
+ echo "$filespec" | (
+ IFS='|'
+ while read fop fspec fperm; do
+ local fop=`echo "$fop" | tr -d ' \t\n'`
+ if [ "$fop" = "+" ]; then
+ if [ ! -e "${src_dir}${fspec}" ]; then
+ echo "File not found '${src_dir}${fspec}'"
+ exit 1
+ fi
+ dpath=`dirname "$fspec"`
+ if [ -z "$fperm" ]; then
+ dperm=`stat -c "%a" ${src_dir}${dpath}`
+ fi
+ mkdir -p -m$dperm ${dst_dir}${dpath}
+ echo "copying: '$fspec'"
+ cp -fpR ${src_dir}${fspec} ${dst_dir}${dpath}/
+ if [ -n "$fperm" ]; then
+ chmod -R $fperm ${dst_dir}${fspec}
+ fi
+ elif [ "$fop" = "-" ]; then
+ echo "removing: '$fspec'"
+ rm -fR ${dst_dir}${fspec}
+ elif [ "$fop" = "=" ]; then
+ echo "setting permissions: '$fperm' on '$fspec'"
+ chmod -R $fperm ${dst_dir}${fspec}
+ fi
+ done
+ )
+}
+
+src_dir="$1"
+dst_dir="$2"
+python="$3"
+mode="$4"
+filespec="$5"
+
+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 -name "*\.py" | xargs rm -f
+ # Delete empty folders (if the case)
+ find $dst_dir/usr -type d | xargs rmdir &> /dev/null
+ rmdir $dst_dir/usr &> /dev/null
+ exit 0
+fi
+
+# 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 -b -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 -name "*\.py" | xargs rm -f
diff --git a/lang/python/python3/files/python3-package-lib2to3.mk b/lang/python/python3/files/python3-package-lib2to3.mk
new file mode 100644
index 000000000..ed712b6fd
--- /dev/null
+++ b/lang/python/python3/files/python3-package-lib2to3.mk
@@ -0,0 +1,18 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-lib2to3
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) lib2to3 module
+ DEPENDS:=+python3
+endef
+
+$(eval $(call Py3BasePackage,python3-lib2to3, \
+ /usr/lib/python$(PYTHON3_VERSION)/lib2to3 \
+ , \
+ DO_NOT_ADD_TO_PACKAGE_DEPENDS \
+))
diff --git a/lang/python/python3/files/python3-package-logging.mk b/lang/python/python3/files/python3-package-logging.mk
new file mode 100644
index 000000000..fa3ec0e17
--- /dev/null
+++ b/lang/python/python3/files/python3-package-logging.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-logging
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) logging module
+ DEPENDS:=+python3-light
+endef
+
+$(eval $(call Py3BasePackage,python3-logging, \
+ /usr/lib/python$(PYTHON3_VERSION)/logging \
+))
diff --git a/lang/python/python3/files/python3-package-lzma.mk b/lang/python/python3/files/python3-package-lzma.mk
new file mode 100644
index 000000000..57b38eced
--- /dev/null
+++ b/lang/python/python3/files/python3-package-lzma.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-lzma
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) lzma module
+ DEPENDS:=+python3-light +liblzma
+endef
+
+$(eval $(call Py3BasePackage,python3-lzma, \
+ /usr/lib/python$(PYTHON3_VERSION)/lzma.py \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_lzma.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/lang/python/python3/files/python3-package-multiprocessing.mk b/lang/python/python3/files/python3-package-multiprocessing.mk
new file mode 100644
index 000000000..c7976016d
--- /dev/null
+++ b/lang/python/python3/files/python3-package-multiprocessing.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-multiprocessing
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) multiprocessing
+ DEPENDS:=+python3-light
+endef
+
+$(eval $(call Py3BasePackage,python3-multiprocessing, \
+ /usr/lib/python$(PYTHON3_VERSION)/multiprocessing \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_multiprocessing.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/lang/python/python3/files/python3-package-ncurses.mk b/lang/python/python3/files/python3-package-ncurses.mk
new file mode 100644
index 000000000..45649ac75
--- /dev/null
+++ b/lang/python/python3/files/python3-package-ncurses.mk
@@ -0,0 +1,18 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-ncurses
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) ncurses module
+ DEPENDS:=+python3-light +libncurses
+endef
+
+$(eval $(call Py3BasePackage,python3-ncurses, \
+ /usr/lib/python$(PYTHON3_VERSION)/curses \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_curses.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_curses_panel.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/lang/python/python3/files/python3-package-openssl.mk b/lang/python/python3/files/python3-package-openssl.mk
new file mode 100644
index 000000000..6971993f7
--- /dev/null
+++ b/lang/python/python3/files/python3-package-openssl.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-openssl
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) SSL module
+ DEPENDS:=+python3-light +libopenssl
+endef
+
+$(eval $(call Py3BasePackage,python3-openssl, \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_hashlib.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_ssl.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/lang/python/python3/files/python3-package-pip.mk b/lang/python/python3/files/python3-package-pip.mk
new file mode 100644
index 000000000..0bd54aac8
--- /dev/null
+++ b/lang/python/python3/files/python3-package-pip.mk
@@ -0,0 +1,28 @@
+#
+# Copyright (C) 2017 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-pip
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) pip module
+ VERSION:=$(PYTHON3_PIP_VERSION)
+ DEPENDS:=+python3 +python3-setuptools +python-pip-conf
+endef
+
+define Py3Package/python3-pip/install
+ $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages
+ # Adjust shebang to proper python location on target
+ sed "1s/.*/#\!\/usr\/bin\/python$(PYTHON3_VERSION)/" -i $(PKG_BUILD_DIR)/install-pip/bin/*
+ $(CP) $(PKG_BUILD_DIR)/install-pip/bin/pip3* $(1)/usr/bin
+ $(CP) \
+ $(PKG_BUILD_DIR)/install-pip/lib/python$(PYTHON3_VERSION)/site-packages/pip \
+ $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/
+endef
+
+$(eval $(call Py3BasePackage,python3-pip, \
+ , \
+ DO_NOT_ADD_TO_PACKAGE_DEPENDS \
+))
diff --git a/lang/python/python3/files/python3-package-pydoc.mk b/lang/python/python3/files/python3-package-pydoc.mk
new file mode 100644
index 000000000..9ab1a5b8b
--- /dev/null
+++ b/lang/python/python3/files/python3-package-pydoc.mk
@@ -0,0 +1,18 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-pydoc
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) pydoc module
+ DEPENDS:=+python3-light
+endef
+
+$(eval $(call Py3BasePackage,python3-pydoc, \
+ /usr/lib/python$(PYTHON3_VERSION)/doctest.py \
+ /usr/lib/python$(PYTHON3_VERSION)/pydoc.py \
+ /usr/lib/python$(PYTHON3_VERSION)/pydoc_data \
+))
diff --git a/lang/python/python3/files/python3-package-setuptools.mk b/lang/python/python3/files/python3-package-setuptools.mk
new file mode 100644
index 000000000..52d56e9ed
--- /dev/null
+++ b/lang/python/python3/files/python3-package-setuptools.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2017 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-setuptools
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) setuptools module
+ VERSION:=$(PYTHON3_SETUPTOOLS_VERSION)
+ DEPENDS:=+python3
+endef
+
+define Py3Package/python3-setuptools/install
+ $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages
+ # Adjust shebang to proper python location on target
+ sed "1s/.*/#\!\/usr\/bin\/python$(PYTHON3_VERSION)/" -i $(PKG_BUILD_DIR)/install-setuptools/bin/*
+ $(CP) $(PKG_BUILD_DIR)/install-setuptools/bin/easy_install-* $(1)/usr/bin
+ $(LN) easy_install-$(PYTHON3_VERSION) $(1)/usr/bin/easy_install-3
+ $(CP) \
+ $(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON3_VERSION)/site-packages/pkg_resources \
+ $(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON3_VERSION)/site-packages/setuptools \
+ $(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON3_VERSION)/site-packages/easy_install.py \
+ $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages
+endef
+
+$(eval $(call Py3BasePackage,python3-setuptools, \
+ , \
+ DO_NOT_ADD_TO_PACKAGE_DEPENDS \
+))
diff --git a/lang/python/python3/files/python3-package-sqlite3.mk b/lang/python/python3/files/python3-package-sqlite3.mk
new file mode 100644
index 000000000..665bff26a
--- /dev/null
+++ b/lang/python/python3/files/python3-package-sqlite3.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-sqlite3
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) sqlite3 module
+ DEPENDS:=+python3-light +libsqlite3
+endef
+
+$(eval $(call Py3BasePackage,python3-sqlite3, \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_sqlite3.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/sqlite3 \
+))
diff --git a/lang/python/python3/files/python3-package-unittest.mk b/lang/python/python3/files/python3-package-unittest.mk
new file mode 100644
index 000000000..d9df86f71
--- /dev/null
+++ b/lang/python/python3/files/python3-package-unittest.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-unittest
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) unittest module
+ DEPENDS:=+python3-light
+endef
+
+$(eval $(call Py3BasePackage,python3-unittest, \
+ /usr/lib/python$(PYTHON3_VERSION)/unittest \
+))
diff --git a/lang/python/python3/files/python3-package-xml.mk b/lang/python/python3/files/python3-package-xml.mk
new file mode 100644
index 000000000..4893fa93c
--- /dev/null
+++ b/lang/python/python3/files/python3-package-xml.mk
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-xml
+$(call Package/python3/Default)
+ TITLE:=Python $(PYTHON3_VERSION) xml libs
+ DEPENDS:=+python3-light
+endef
+
+$(eval $(call Py3BasePackage,python3-xml, \
+ /usr/lib/python$(PYTHON3_VERSION)/xml \
+ /usr/lib/python$(PYTHON3_VERSION)/xmlrpc \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_elementtree.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/pyexpat.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/lang/python/python3/files/python3-package.mk b/lang/python/python3/files/python3-package.mk
new file mode 100644
index 000000000..a28689aba
--- /dev/null
+++ b/lang/python/python3/files/python3-package.mk
@@ -0,0 +1,137 @@
+#
+# Copyright (C) 2007-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+$(call include_mk, python3-version.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)
+
+PYTHON3_PKG_DIR:=/usr/lib/python$(PYTHON3_VERSION)/site-packages
+
+PYTHON3:=python$(PYTHON3_VERSION)
+
+PYTHON3PATH:=$(PYTHON3_LIB_DIR):$(STAGING_DIR)/$(PYTHON3_PKG_DIR):$(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR)
+
+# These configure args are needed in detection of path to Python header files
+# using autotools.
+CONFIGURE_ARGS += \
+ _python_sysroot="$(STAGING_DIR)" \
+ _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
+
+define Py3Package
+
+ define Package/$(1)-src
+ $(call Package/$(1))
+ TITLE+= (sources)
+ DEPENDS:=$$$$(foreach dep,$$$$(filter +python3-%,$$$$(DEPENDS)),$$$$(dep)-src)
+ endef
+
+ define Package/$(1)-src/description
+ $(call Package/$(1)/description).
+ (Contains the Python3 sources for this package).
+ endef
+
+ # Add default PyPackage filespec none defined
+ ifndef Py3Package/$(1)/filespec
+ define Py3Package/$(1)/filespec
+ +|$(PYTHON3_PKG_DIR)
+ endef
+ 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
+ endef
+ endif
+
+ $(call shexport,Py3Package/$(1)/filespec)
+
+ define Package/$(1)/install
+ $(call Py3Package/$(1)/install,$$(1))
+ find $(PKG_INSTALL_DIR) -name "*\.exe" | xargs rm -f
+ if [ -e files/python3-package-install.sh ] ; then \
+ $(SHELL) files/python3-package-install.sh \
+ "$(PKG_INSTALL_DIR)" "$$(1)" \
+ "$(HOST_PYTHON3_BIN)" "$$(2)" \
+ "$$$$$$$$$$(call shvar,Py3Package/$(1)/filespec)" ; \
+ elif [ -e $(STAGING_DIR)/mk/python3-package-install.sh ] ; then \
+ $(SHELL) $(STAGING_DIR)/mk/python3-package-install.sh \
+ "$(PKG_INSTALL_DIR)" "$$(1)" \
+ "$(HOST_PYTHON3_BIN)" "$$(2)" \
+ "$$$$$$$$$$(call shvar,Py3Package/$(1)/filespec)" ; \
+ else \
+ echo "No 'python3-package-install.sh' script found" ; \
+ exit 1 ; \
+ fi
+ endef
+
+ define Package/$(1)-src/install
+ $$(call Package/$(1)/install,$$(1),sources)
+ endef
+endef
+
+$(call include_mk, python3-host.mk)
+
+# $(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))
+ find $(PKG_INSTALL_DIR) -name "*\.exe" | xargs rm -f
+endef
+
+define Py3Build/Compile/Default
+ $(call Build/Compile/Py3Mod,, \
+ install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
+ --single-version-externally-managed \
+ )
+endef
+
+ifeq ($(BUILD_VARIANT),python3)
+define Build/Compile
+ $(call Py3Build/Compile/Default)
+endef
+endif # python3
diff --git a/lang/python/python3/files/python3-version.mk b/lang/python/python3/files/python3-version.mk
new file mode 100644
index 000000000..efe953cdc
--- /dev/null
+++ b/lang/python/python3/files/python3-version.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2007-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+# Note: keep in sync with setuptools & pip
+PYTHON3_VERSION_MAJOR:=3
+PYTHON3_VERSION_MINOR:=6
+PYTHON3_VERSION_MICRO:=1
+
+PYTHON3_VERSION:=$(PYTHON3_VERSION_MAJOR).$(PYTHON3_VERSION_MINOR)
+
+PYTHON3_SETUPTOOLS_VERSION:=28.8.0
+PYTHON3_PIP_VERSION:=9.0.1
+
diff --git a/lang/python/python3/patches/001-enable-zlib.patch b/lang/python/python3/patches/001-enable-zlib.patch
new file mode 100644
index 000000000..780831e86
--- /dev/null
+++ b/lang/python/python3/patches/001-enable-zlib.patch
@@ -0,0 +1,25 @@
+From 6eeab87bc852481e599325549c854b701bf2e39f Mon Sep 17 00:00:00 2001
+From: Alexandru Ardelean <aa@ocedo.com>
+Date: Thu, 25 Sep 2014 18:18:29 +0300
+Subject: [PATCH] enable zlib
+
+---
+ Modules/Setup.dist | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Modules/Setup.dist b/Modules/Setup.dist
+index 01fb85f..01ac492 100644
+--- a/Modules/Setup.dist
++++ b/Modules/Setup.dist
+@@ -358,7 +358,7 @@ _symtable symtablemodule.c
+ # Andrew Kuchling's zlib module.
+ # This require zlib 1.1.3 (or later).
+ # See http://www.gzip.org/zlib/
+-#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
++zlib zlibmodule.c -lz
+
+ # Interface to the Expat XML parser
+ #
+--
+1.8.4.5
+
diff --git a/lang/python/python3/patches/003-do-not-run-distutils-tests.patch b/lang/python/python3/patches/003-do-not-run-distutils-tests.patch
new file mode 100644
index 000000000..77c089f5f
--- /dev/null
+++ b/lang/python/python3/patches/003-do-not-run-distutils-tests.patch
@@ -0,0 +1,46 @@
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index ce2c0aa..b0c8322 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1256,41 +1256,6 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
+ done; \
+ done
+ $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
+- if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
+- $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
+- $(DESTDIR)$(LIBDEST)/distutils/tests ; \
+- fi
+- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+- -d $(LIBDEST) -f \
+- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+- $(DESTDIR)$(LIBDEST)
+- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
+- -d $(LIBDEST) -f \
+- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+- $(DESTDIR)$(LIBDEST)
+- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \
+- -d $(LIBDEST) -f \
+- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+- $(DESTDIR)$(LIBDEST)
+- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+- -d $(LIBDEST)/site-packages -f \
+- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
+- -d $(LIBDEST)/site-packages -f \
+- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \
+- -d $(LIBDEST)/site-packages -f \
+- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
+- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
+
+ # Create the PLATDIR source directory, if one wasn't distributed..
+ $(srcdir)/Lib/$(PLATDIR):
diff --git a/lang/python/python3/patches/004-do-not-write-bytes-codes.patch b/lang/python/python3/patches/004-do-not-write-bytes-codes.patch
new file mode 100644
index 000000000..1da7b8be8
--- /dev/null
+++ b/lang/python/python3/patches/004-do-not-write-bytes-codes.patch
@@ -0,0 +1,22 @@
+diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
+index a17adf7..415b3f6 100644
+--- a/Python/pylifecycle.c
++++ b/Python/pylifecycle.c
+@@ -86,7 +86,7 @@ int Py_BytesWarningFlag; /* Warn on str(bytes) and str(buffer) */
+ int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */
+ int Py_FrozenFlag; /* Needed by getpath.c */
+ int Py_IgnoreEnvironmentFlag; /* e.g. PYTHONPATH, PYTHONHOME */
+-int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */
++int Py_DontWriteBytecodeFlag = 1; /* Suppress writing bytecode files (*.py[co]) */
+ int Py_NoUserSiteDirectory = 0; /* for -s and site.py */
+ int Py_UnbufferedStdioFlag = 0; /* Unbuffered binary std{in,out,err} */
+ int Py_HashRandomizationFlag = 0; /* for -R and PYTHONHASHSEED */
+@@ -309,7 +309,7 @@ _Py_InitializeEx_Private(int install_sigs, int install_importlib)
+ if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0')
+ Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p);
+ if ((p = Py_GETENV("PYTHONDONTWRITEBYTECODE")) && *p != '\0')
+- Py_DontWriteBytecodeFlag = add_flag(Py_DontWriteBytecodeFlag, p);
++ Py_DontWriteBytecodeFlag = atoi(p);
+ /* The variable is only tested for existence here; _PyRandom_Init will
+ check its value further. */
+ if ((p = Py_GETENV("PYTHONHASHSEED")) && *p != '\0')
diff --git a/lang/python/python3/patches/006-remove-debian-multiarch-support.patch b/lang/python/python3/patches/006-remove-debian-multiarch-support.patch
new file mode 100644
index 000000000..52d52b94e
--- /dev/null
+++ b/lang/python/python3/patches/006-remove-debian-multiarch-support.patch
@@ -0,0 +1,12 @@
+diff --git a/setup.py b/setup.py
+index 7868b7b..9ae0ef2 100644
+--- a/setup.py
++++ b/setup.py
+@@ -444,7 +444,6 @@ class PyBuildExt(build_ext):
+ add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+ if cross_compiling:
+ self.add_gcc_paths()
+- self.add_multiarch_paths()
+
+ # Add paths specified in the environment variables LDFLAGS and
+ # CPPFLAGS for header and library files.
diff --git a/lang/python/python3/patches/007-distutils-do-not-adjust-path.patch b/lang/python/python3/patches/007-distutils-do-not-adjust-path.patch
new file mode 100644
index 000000000..49fe92629
--- /dev/null
+++ b/lang/python/python3/patches/007-distutils-do-not-adjust-path.patch
@@ -0,0 +1,10 @@
+--- a/Lib/distutils/command/build_scripts.py
++++ b/Lib/distutils/command/build_scripts.py
+@@ -89,6 +89,7 @@ class build_scripts (Command):
+ adjust = 1
+ post_interp = match.group(1) or ''
+
++ adjust = 0
+ if adjust:
+ log.info("copying and adjusting %s -> %s", script,
+ self.build_dir)
diff --git a/lang/python/python3/patches/010-do-not-add-rt-lib-dirs-when-cross-compiling.patch b/lang/python/python3/patches/010-do-not-add-rt-lib-dirs-when-cross-compiling.patch
new file mode 100644
index 000000000..5a106d4e8
--- /dev/null
+++ b/lang/python/python3/patches/010-do-not-add-rt-lib-dirs-when-cross-compiling.patch
@@ -0,0 +1,15 @@
+diff --git a/setup.py b/setup.py
+index 7868b7b..544fa7e 100644
+--- a/setup.py
++++ b/setup.py
+@@ -452,8 +452,9 @@ class PyBuildExt(build_ext):
+ # directly since an inconsistently reproducible issue comes up where
+ # the environment variable is not set even though the value were passed
+ # into configure and stored in the Makefile (issue found on OS X 10.3).
++ rt_lib_dirs = [] if cross_compiling else self.compiler.runtime_library_dirs
+ for env_var, arg_name, dir_list in (
+- ('LDFLAGS', '-R', self.compiler.runtime_library_dirs),
++ ('LDFLAGS', '-R', rt_lib_dirs),
+ ('LDFLAGS', '-L', self.compiler.library_dirs),
+ ('CPPFLAGS', '-I', self.compiler.include_dirs)):
+ env_val = sysconfig.get_config_var(env_var)
diff --git a/lang/python/python3/patches/011-fix-ncursesw-definition-colisions.patch b/lang/python/python3/patches/011-fix-ncursesw-definition-colisions.patch
new file mode 100644
index 000000000..652932102
--- /dev/null
+++ b/lang/python/python3/patches/011-fix-ncursesw-definition-colisions.patch
@@ -0,0 +1,12 @@
+diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
+index 3bf2ca7..c156964 100644
+--- a/Modules/_cursesmodule.c
++++ b/Modules/_cursesmodule.c
+@@ -116,7 +116,6 @@ char *PyCursesVersion = "2.2";
+ #defines many common symbols (such as "lines") which breaks the
+ curses module in other ways. So the code will just specify
+ explicit prototypes here. */
+-extern int setupterm(char *,int,int *);
+ #ifdef __sgi
+ #include <term.h>
+ #endif
diff --git a/lang/python/python3/patches/012-disable-wcsftime-detection.patch b/lang/python/python3/patches/012-disable-wcsftime-detection.patch
new file mode 100644
index 000000000..55a383c28
--- /dev/null
+++ b/lang/python/python3/patches/012-disable-wcsftime-detection.patch
@@ -0,0 +1,13 @@
+diff --git a/configure b/configure
+index 274af7e..85bbf0e 100755
+--- a/configure
++++ b/configure
+@@ -10555,7 +10555,7 @@ for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
+ sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy symlinkat sync \
+ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
+ truncate uname unlinkat unsetenv utimensat utimes waitid waitpid wait3 wait4 \
+- wcscoll wcsftime wcsxfrm wmemcmp writev _getpty
++ wcscoll wcsxfrm wmemcmp writev _getpty
+ do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/lang/python/python3/patches/014-remove-platform-so-suffix.patch b/lang/python/python3/patches/014-remove-platform-so-suffix.patch
new file mode 100644
index 000000000..cbc32d57a
--- /dev/null
+++ b/lang/python/python3/patches/014-remove-platform-so-suffix.patch
@@ -0,0 +1,26 @@
+diff --git a/configure b/configure
+index e823a08..84c525f 100755
+--- a/configure
++++ b/configure
+@@ -14365,7 +14365,7 @@ $as_echo_n "checking ABIFLAGS... " >&6; }
+ $as_echo "$ABIFLAGS" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking SOABI" >&5
+ $as_echo_n "checking SOABI... " >&6; }
+-SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET}
++SOABI='cpython-'`echo $VERSION | tr -d .`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SOABI" >&5
+ $as_echo "$SOABI" >&6; }
+
+diff --git a/configure.ac b/configure.ac
+index 56a73df..1855af5 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4314,7 +4314,7 @@ AC_SUBST(SOABI)
+ AC_MSG_CHECKING(ABIFLAGS)
+ AC_MSG_RESULT($ABIFLAGS)
+ AC_MSG_CHECKING(SOABI)
+-SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET}
++SOABI='cpython-'`echo $VERSION | tr -d .`
+ AC_MSG_RESULT($SOABI)
+
+ AC_SUBST(EXT_SUFFIX)
diff --git a/lang/python/python3/patches/015-abort-on-failed-modules.patch b/lang/python/python3/patches/015-abort-on-failed-modules.patch
new file mode 100644
index 000000000..eec488f3d
--- /dev/null
+++ b/lang/python/python3/patches/015-abort-on-failed-modules.patch
@@ -0,0 +1,12 @@
+diff --git a/setup.py b/setup.py
+index da67731..928e0de 100644
+--- a/setup.py
++++ b/setup.py
+@@ -293,6 +293,7 @@ class PyBuildExt(build_ext):
+ print("Failed to build these modules:")
+ print_three_column(failed)
+ print()
++ if cross_compiling: sys.exit(1)
+
+ if self.failed_on_import:
+ failed = self.failed_on_import[:]
diff --git a/lang/python/python3/patches/016-adjust-config-paths.patch b/lang/python/python3/patches/016-adjust-config-paths.patch
new file mode 100644
index 000000000..fb709b7e4
--- /dev/null
+++ b/lang/python/python3/patches/016-adjust-config-paths.patch
@@ -0,0 +1,72 @@
+diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
+index 8bf1a70..c2708c3 100644
+--- a/Lib/distutils/sysconfig.py
++++ b/Lib/distutils/sysconfig.py
+@@ -424,6 +424,7 @@ def _init_posix():
+ platform=sys.platform,
+ multiarch=getattr(sys.implementation, '_multiarch', ''),
+ ))
++ name = '_sysconfigdata'
+ _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
+ build_time_vars = _temp.build_time_vars
+ global _config_vars
+diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
+index 9314e71..4861261 100644
+--- a/Lib/sysconfig.py
++++ b/Lib/sysconfig.py
+@@ -343,6 +343,7 @@ def get_makefile_filename():
+
+
+ def _get_sysconfigdata_name():
++ return '_sysconfigdata'
+ return os.environ.get('_PYTHON_SYSCONFIGDATA_NAME',
+ '_sysconfigdata_{abi}_{platform}_{multiarch}'.format(
+ abi=sys.abiflags,
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index cd7d33d..ad6572f 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1301,7 +1301,7 @@ libinstall: build_all $(srcdir)/Modules/xxmodule.c
+ esac; \
+ done; \
+ done
+- $(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py \
++ $(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata*.py \
+ $(DESTDIR)$(LIBDEST); \
+ $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
+ if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
+@@ -1436,7 +1436,7 @@ sharedinstall: sharedmods
+ --install-scripts=$(BINDIR) \
+ --install-platlib=$(DESTSHARED) \
+ --root=$(DESTDIR)/
+- -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py
++ -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata*.py
+ -rm -r $(DESTDIR)$(DESTSHARED)/__pycache__
+
+ # Here are a couple of targets for MacOSX again, to install a full
+diff --git a/configure b/configure
+index cf95b27..8203fbb 100755
+--- a/configure
++++ b/configure
+@@ -14895,7 +14895,7 @@ LDVERSION='$(VERSION)$(ABIFLAGS)'
+ $as_echo "$LDVERSION" >&6; }
+
+
+-if test x$PLATFORM_TRIPLET = x; then
++if true ; then
+ LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
+ else
+ LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
+diff --git a/configure.ac b/configure.ac
+index 1d63813..25f25ed 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4600,7 +4600,7 @@ AC_MSG_RESULT($LDVERSION)
+
+ dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
+ AC_SUBST(PY_ENABLE_SHARED)
+-if test x$PLATFORM_TRIPLET = x; then
++if true ; then
+ LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
+ else
+ LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"