commit 05dbcba3d7e31dc606d484fd454404ae7d81595a
parent 86c614e69df3da1bcb5a45b77f3af79445093b48
Author: Steven Barth <steven@midlink.org>
Date: Fri, 6 Mar 2015 15:29:22 +0100
Merge pull request #988 from commodo/python-modularization
python: packetize some python modules
Diffstat:
10 files changed, 215 insertions(+), 48 deletions(-)
diff --git a/lang/python/Makefile b/lang/python/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2006-2014 OpenWrt.org
+# Copyright (C) 2006-2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@@ -12,7 +12,7 @@ include ./files/python-package.mk
PKG_NAME:=python
PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
-PKG_RELEASE:=4
+PKG_RELEASE:=5
PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://www.python.org/ftp/python/$(PKG_VERSION)
@@ -54,7 +54,7 @@ endef
define Package/python-base
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) interpreter
- DEPENDS:=+libpthread +zlib +libffi +libopenssl
+ DEPENDS:=+libpthread +zlib
endef
define Package/python-base/description
@@ -62,13 +62,44 @@ define Package/python-base/description
for the interpreter to start.
endef
+define Package/python-light
+$(call Package/python/Default)
+ TITLE:=Python $(PYTHON_VERSION) light installation
+ DEPENDS:=+python-base +libffi +libbz2
+endef
+
+define Package/python-light/description
+ This package is essentially the python-base package plus
+ a few of the rarely used (and big) libraries stripped out
+ into separate packages.
+endef
+
+# Define newline here, since it's not defined in OpenWRT
+define newline
+
+
+endef
+
+PYTHON_LIB_FILES_DEL:=
+PYTHON_PACKAGES:=
+define PyBasePackage
+ PYTHON_PACKAGES+=$(1)
+ PYTHON_LIB_FILES_DEL+=$(2)
+ define PyPackage/$(1)/filespec
+ $(subst $(space),$(newline),$(foreach lib_file,$(2),+|$(lib_file)))
+ endef
+endef
+
+include ./files/python-package-*.mk
+
define Package/python
$(call Package/python/Default)
- DEPENDS:=+python-base +libncursesw +libbz2 +libgdbm +libsqlite3 +libexpat +libdb47
+ DEPENDS:=+python-light $(foreach package,$(PYTHON_PACKAGES),+$(package))
endef
define Package/python/description
This package contains the (almost) full Python install.
+ It's python-light + all other packages.
endef
MAKE_FLAGS+=\
@@ -124,31 +155,36 @@ define Build/InstallDev
$(1)/usr/lib/python$(PYTHON_VERSION)/
endef
+PYTHON_BASE_LIB_FILES:= \
+ /usr/lib/python$(PYTHON_VERSION)/_abcoll.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)/copy_reg.py \
+ /usr/lib/python$(PYTHON_VERSION)/genericpath.py \
+ /usr/lib/python$(PYTHON_VERSION)/linecache.py \
+ /usr/lib/python$(PYTHON_VERSION)/posixpath.py \
+ /usr/lib/python$(PYTHON_VERSION)/os.py \
+ /usr/lib/python$(PYTHON_VERSION)/re.py \
+ /usr/lib/python$(PYTHON_VERSION)/site.py \
+ /usr/lib/python$(PYTHON_VERSION)/sre_compile.py \
+ /usr/lib/python$(PYTHON_VERSION)/sre_constants.py \
+ /usr/lib/python$(PYTHON_VERSION)/sre_parse.py \
+ /usr/lib/python$(PYTHON_VERSION)/sysconfig.py \
+ /usr/lib/python$(PYTHON_VERSION)/stat.py \
+ /usr/lib/python$(PYTHON_VERSION)/traceback.py \
+ /usr/lib/python$(PYTHON_VERSION)/types.py \
+ /usr/lib/python$(PYTHON_VERSION)/UserDict.py \
+ /usr/lib/python$(PYTHON_VERSION)/warnings.py
+
+PYTHON_BASE_LIB_FILES+=$(PYTHON_BASE_LIB_FILES)
+
define PyPackage/python-base/filespec
+|/usr/bin/python$(PYTHON_VERSION)
-+|/usr/lib/python$(PYTHON_VERSION)/_abcoll.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)/copy_reg.py
-+|/usr/lib/python$(PYTHON_VERSION)/genericpath.py
-+|/usr/lib/python$(PYTHON_VERSION)/linecache.py
-+|/usr/lib/python$(PYTHON_VERSION)/posixpath.py
-+|/usr/lib/python$(PYTHON_VERSION)/os.py
-+|/usr/lib/python$(PYTHON_VERSION)/re.py
-+|/usr/lib/python$(PYTHON_VERSION)/site.py
-+|/usr/lib/python$(PYTHON_VERSION)/sre_compile.py
-+|/usr/lib/python$(PYTHON_VERSION)/sre_constants.py
-+|/usr/lib/python$(PYTHON_VERSION)/sre_parse.py
-+|/usr/lib/python$(PYTHON_VERSION)/sysconfig.py
-+|/usr/lib/python$(PYTHON_VERSION)/stat.py
-+|/usr/lib/python$(PYTHON_VERSION)/traceback.py
-+|/usr/lib/python$(PYTHON_VERSION)/types.py
-+|/usr/lib/python$(PYTHON_VERSION)/UserDict.py
-+|/usr/lib/python$(PYTHON_VERSION)/warnings.py
-endef
-
-define PyPackage/python/filespec
+$(subst $(space),$(newline),$(foreach lib_file,$(PYTHON_BASE_LIB_FILES),+|$(lib_file)))
+endef
+
+define PyPackage/python-light/filespec
+|/usr/lib/python$(PYTHON_VERSION)
-|/usr/lib/python$(PYTHON_VERSION)/config
-|/usr/lib/python$(PYTHON_VERSION)/distutils/cygwinccompiler.py
@@ -164,26 +200,7 @@ define PyPackage/python/filespec
-|/usr/lib/python$(PYTHON_VERSION)/*/test
-|/usr/lib/python$(PYTHON_VERSION)/*/tests
-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/readline.so
--|/usr/lib/python$(PYTHON_VERSION)/_abcoll.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)/copy_reg.py
--|/usr/lib/python$(PYTHON_VERSION)/genericpath.py
--|/usr/lib/python$(PYTHON_VERSION)/linecache.py
--|/usr/lib/python$(PYTHON_VERSION)/posixpath.py
--|/usr/lib/python$(PYTHON_VERSION)/os.py
--|/usr/lib/python$(PYTHON_VERSION)/re.py
--|/usr/lib/python$(PYTHON_VERSION)/site.py
--|/usr/lib/python$(PYTHON_VERSION)/sre_compile.py
--|/usr/lib/python$(PYTHON_VERSION)/sre_constants.py
--|/usr/lib/python$(PYTHON_VERSION)/sre_parse.py
--|/usr/lib/python$(PYTHON_VERSION)/sysconfig.py
--|/usr/lib/python$(PYTHON_VERSION)/stat.py
--|/usr/lib/python$(PYTHON_VERSION)/traceback.py
--|/usr/lib/python$(PYTHON_VERSION)/types.py
--|/usr/lib/python$(PYTHON_VERSION)/UserDict.py
--|/usr/lib/python$(PYTHON_VERSION)/warnings.py
+$(subst $(space),$(newline),$(foreach lib_file,$(PYTHON_LIB_FILES_DEL),-|$(lib_file)))
endef
define PyPackage/python-base/install
@@ -192,6 +209,10 @@ define PyPackage/python-base/install
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* $(1)/usr/lib/
endef
+# Dummy rule so that the package gets picked up
+define Package/python/install
+endef
+
HOST_CFLAGS+= \
-I/usr/include/ncursesw \
-I/usr/include/ncurses
@@ -213,8 +234,15 @@ endef
$(eval $(call HostBuild))
+$(foreach package, $(PYTHON_PACKAGES), \
+ $(eval $(call PyPackage,$(package))) \
+ $(eval $(call BuildPackage,$(package))) \
+)
+
$(eval $(call PyPackage,python-base))
+$(eval $(call PyPackage,python-light))
$(eval $(call PyPackage,python))
$(eval $(call BuildPackage,python-base))
+$(eval $(call BuildPackage,python-light))
$(eval $(call BuildPackage,python))
diff --git a/lang/python/files/python-package-bsddb.mk b/lang/python/files/python-package-bsddb.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2006-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python-bsddb
+$(call Package/python/Default)
+ TITLE:=Python $(PYTHON_VERSION) bsddb module
+ DEPENDS:=+python-light +libdb47
+endef
+
+$(eval $(call PyBasePackage,python-bsddb, \
+ /usr/lib/python$(PYTHON_VERSION)/bsddb \
+ /usr/lib/python$(PYTHON_VERSION)/lib-dynload/_bsddb.so \
+))
diff --git a/lang/python/files/python-package-codecs.mk b/lang/python/files/python-package-codecs.mk
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2006-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python-codecs
+$(call Package/python/Default)
+ TITLE:=Python $(PYTHON_VERSION) codecs + unicode support
+ DEPENDS:=+python-light
+endef
+
+$(eval $(call PyBasePackage,python-codecs, \
+ /usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_cn.so \
+ /usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_hk.so \
+ /usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_iso2022.so \
+ /usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_jp.so \
+ /usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_kr.so \
+ /usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_tw.so \
+ /usr/lib/python$(PYTHON_VERSION)/lib-dynload/unicodedata.so \
+))
diff --git a/lang/python/files/python-package-dbm.mk b/lang/python/files/python-package-dbm.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2006-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python-dbm
+$(call Package/python/Default)
+ TITLE:=Python $(PYTHON_VERSION) dbm module
+ DEPENDS:=+python-light +libdb47
+endef
+
+$(eval $(call PyBasePackage,python-dbm, \
+ /usr/lib/python$(PYTHON_VERSION)/lib-dynload/dbm.so \
+))
diff --git a/lang/python/files/python-package-gdbm.mk b/lang/python/files/python-package-gdbm.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2006-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python-gdbm
+$(call Package/python/Default)
+ TITLE:=Python $(PYTHON_VERSION) gdbm module
+ DEPENDS:=+python-light +libgdbm
+endef
+
+$(eval $(call PyBasePackage,python-gdbm, \
+ /usr/lib/python$(PYTHON_VERSION)/lib-dynload/gdbm.so \
+))
diff --git a/lang/python/files/python-package-ncurses.mk b/lang/python/files/python-package-ncurses.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2006-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python-ncurses
+$(call Package/python/Default)
+ TITLE:=Python $(PYTHON_VERSION) ncurses module
+ DEPENDS:=+python-light +libncursesw
+endef
+
+$(eval $(call PyBasePackage,python-ncurses, \
+ /usr/lib/python$(PYTHON_VERSION)/lib-dynload/_curses.so \
+ /usr/lib/python$(PYTHON_VERSION)/lib-dynload/_curses_panel.so \
+))
diff --git a/lang/python/files/python-package-openssl.mk b/lang/python/files/python-package-openssl.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2006-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python-openssl
+$(call Package/python/Default)
+ TITLE:=Python $(PYTHON_VERSION) SSL module
+ DEPENDS:=+python-light +libopenssl
+endef
+
+$(eval $(call PyBasePackage,python-openssl, \
+ /usr/lib/python$(PYTHON_VERSION)/lib-dynload/_hashlib.so \
+ /usr/lib/python$(PYTHON_VERSION)/lib-dynload/_ssl.so \
+))
diff --git a/lang/python/files/python-package-pydoc.mk b/lang/python/files/python-package-pydoc.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2006-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python-pydoc
+$(call Package/python/Default)
+ TITLE:=Python $(PYTHON_VERSION) pydoc module
+ DEPENDS:=+python-light
+endef
+
+$(eval $(call PyBasePackage,python-pydoc, \
+ /usr/lib/python$(PYTHON_VERSION)/pydoc.py \
+ /usr/lib/python$(PYTHON_VERSION)/pydoc_data \
+))
diff --git a/lang/python/files/python-package-sqlite3.mk b/lang/python/files/python-package-sqlite3.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2006-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python-sqlite3
+$(call Package/python/Default)
+ TITLE:=Python $(PYTHON_VERSION) sqlite3 module
+ DEPENDS:=+python-light +libsqlite3
+endef
+
+$(eval $(call PyBasePackage,python-sqlite3, \
+ /usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sqlite3.so \
+ /usr/lib/python$(PYTHON_VERSION)/sqlite3 \
+))
diff --git a/lang/python/files/python-package.mk b/lang/python/files/python-package.mk
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2007-2014 OpenWrt.org
+# Copyright (C) 2006-2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.