summaryrefslogtreecommitdiff
path: root/lang/python/python3/files
diff options
context:
space:
mode:
authorHannu Nyman <hannu.nyman@iki.fi>2017-05-18 10:48:58 +0300
committerGitHub <noreply@github.com>2017-05-18 10:48:58 +0300
commit675585a66f48d53b8f1f7308f19d606a5664f3a7 (patch)
tree8ca48b5730d8762ef2c498ff9b62569d3d41ca59 /lang/python/python3/files
parent5c8edf89482bd2a9d192faba8ab9ee4a9d71373d (diff)
parent68312f49c0b4456e665ed438a86a44738caa765a (diff)
Merge pull request #4365 from commodo/python-groupping
python packages: move all things python under lang/python
Diffstat (limited to 'lang/python/python3/files')
-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
26 files changed, 713 insertions, 0 deletions
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
+