Quellcode durchsuchen

python3: replicate packaging work done in python package

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Alexandru Ardelean vor 10 Jahren
Ursprung
Commit
741fdfd1e0

+ 73
- 19
lang/python3/Makefile Datei anzeigen

@@ -1,5 +1,5 @@
1 1
 #
2
-# Copyright (C) 2006-2014 OpenWrt.org
2
+# Copyright (C) 2006-2015 OpenWrt.org
3 3
 #
4 4
 # This is free software, licensed under the GNU General Public License v2.
5 5
 # See /LICENSE for more information.
@@ -57,7 +57,7 @@ endef
57 57
 define Package/python3-base
58 58
 $(call Package/python3/Default)
59 59
   TITLE:=Python $(PYTHON_VERSION) interpreter
60
-  DEPENDS:=+libpthread +zlib +libffi +libopenssl
60
+  DEPENDS:=+libpthread +zlib
61 61
 endef
62 62
 
63 63
 define Package/python3-base/description
@@ -65,13 +65,45 @@ define Package/python3-base/description
65 65
   for the interpreter to start.
66 66
 endef
67 67
 
68
+define Package/python3-light
69
+$(call Package/python3/Default)
70
+  TITLE:=Python $(PYTHON_VERSION) light installation
71
+  DEPENDS:=+python3-base +libffi +libbz2
72
+endef
73
+
74
+define Package/python3-light/description
75
+  This package is essentially the python3-base package plus
76
+  a few of the rarely used (and big) libraries stripped out
77
+  into separate packages.
78
+endef
79
+
80
+# Define newline here, since it's not defined in OpenWRT
81
+define newline
82
+
83
+
84
+endef
85
+
86
+PYTHON3_LIB_FILES_DEL:=
87
+PYTHON3_PACKAGES:=
88
+PYTHON3_SO_SUFFIX:=cpython-34.so
89
+define Py3BasePackage
90
+  PYTHON3_PACKAGES+=$(1)
91
+  PYTHON3_LIB_FILES_DEL+=$(2)
92
+  define Py3Package/$(1)/filespec
93
+    $(subst $(space),$(newline),$(foreach lib_file,$(2),+|$(lib_file)))
94
+  endef
95
+endef
96
+
97
+include ./files/python3-package-*.mk
98
+
68 99
 define Package/python3
69 100
 $(call Package/python3/Default)
70
-  DEPENDS:=+python3-base +libncursesw +libbz2 +libgdbm +libsqlite3 +libdb47
101
+  DEPENDS:=+python3-light $(foreach package,$(PYTHON3_PACKAGES),+$(package))
71 102
 endef
72 103
 
73 104
 define Package/python3/description
74 105
   This package contains the (almost) full Python install.
106
+  It's python3-light + all other packages.
75 107
 endef
76 108
 
77 109
 MAKE_FLAGS+=\
@@ -123,29 +155,34 @@ define Build/InstallDev
123 155
 		$(1)/usr/lib/python$(PYTHON_VERSION)/
124 156
 endef
125 157
 
158
+PYTHON3_BASE_LIB_FILES:= \
159
+	/usr/lib/python$(PYTHON_VERSION)/_collections_abc.py \
160
+	/usr/lib/python$(PYTHON_VERSION)/_sitebuiltins.py \
161
+	/usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py \
162
+	/usr/lib/python$(PYTHON_VERSION)/_weakrefset.py \
163
+	/usr/lib/python$(PYTHON_VERSION)/abc.py \
164
+	/usr/lib/python$(PYTHON_VERSION)/codecs.py \
165
+	/usr/lib/python$(PYTHON_VERSION)/genericpath.py \
166
+	/usr/lib/python$(PYTHON_VERSION)/io.py \
167
+	/usr/lib/python$(PYTHON_VERSION)/os.py \
168
+	/usr/lib/python$(PYTHON_VERSION)/posixpath.py \
169
+	/usr/lib/python$(PYTHON_VERSION)/site.py \
170
+	/usr/lib/python$(PYTHON_VERSION)/sysconfig.py \
171
+	/usr/lib/python$(PYTHON_VERSION)/stat.py
172
+
173
+PYTHON3_LIB_FILES_DEL+=$(PYTHON3_BASE_LIB_FILES)
174
+
126 175
 define Py3Package/python3-base/filespec
127 176
 +|/usr/bin/python$(PYTHON_VERSION)
128
-+|/usr/lib/python$(PYTHON_VERSION)/encodings
129
-+|/usr/lib/python$(PYTHON_VERSION)/_collections_abc.py
130
-+|/usr/lib/python$(PYTHON_VERSION)/_sitebuiltins.py
131
-+|/usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py
132
-+|/usr/lib/python$(PYTHON_VERSION)/_weakrefset.py
133
-+|/usr/lib/python$(PYTHON_VERSION)/abc.py
134
-+|/usr/lib/python$(PYTHON_VERSION)/codecs.py
135
-+|/usr/lib/python$(PYTHON_VERSION)/genericpath.py
136
-+|/usr/lib/python$(PYTHON_VERSION)/io.py
137
-+|/usr/lib/python$(PYTHON_VERSION)/os.py
138
-+|/usr/lib/python$(PYTHON_VERSION)/posixpath.py
139
-+|/usr/lib/python$(PYTHON_VERSION)/site.py
140
-+|/usr/lib/python$(PYTHON_VERSION)/sysconfig.py
141
-+|/usr/lib/python$(PYTHON_VERSION)/stat.py
177
+$(subst $(space),$(newline),$(foreach lib_file,$(PYTHON3_BASE_LIB_FILES),+|$(lib_file)))
142 178
 endef
143 179
 
144
-define Py3Package/python3/filespec
180
+define Py3Package/python3-light/filespec
145 181
 +|/usr/lib/python$(PYTHON_VERSION)
146 182
 -|/usr/lib/python$(PYTHON_VERSION)/config-$(PYTHON_VERSION)
147 183
 -|/usr/lib/python$(PYTHON_VERSION)/distutils/cygwinccompiler.py
148 184
 -|/usr/lib/python$(PYTHON_VERSION)/distutils/command/wininst*
185
+-|/usr/lib/python$(PYTHON_VERSION)/ensurepip
149 186
 -|/usr/lib/python$(PYTHON_VERSION)/idlelib
150 187
 -|/usr/lib/python$(PYTHON_VERSION)/lib2to3
151 188
 -|/usr/lib/python$(PYTHON_VERSION)/tkinter
@@ -157,6 +194,8 @@ define Py3Package/python3/filespec
157 194
 -|/usr/lib/python$(PYTHON_VERSION)/webbrowser.py
158 195
 -|/usr/lib/python$(PYTHON_VERSION)/*/test
159 196
 -|/usr/lib/python$(PYTHON_VERSION)/*/tests
197
+-|/usr/lib/python$(PYTHON_VERSION)/_osx_support.py
198
+$(subst $(space),$(newline),$(foreach lib_file,$(PYTHON3_LIB_FILES_DEL),-|$(lib_file)))
160 199
 endef
161 200
 
162 201
 define Py3Package/python3-base/install
@@ -167,6 +206,14 @@ define Py3Package/python3-base/install
167 206
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* $(1)/usr/lib/
168 207
 endef
169 208
 
209
+define Py3Package/python3/filespec
210
+-|$(PYTHON3_PKG_DIR)
211
+endef
212
+
213
+HOST_CFLAGS+= \
214
+	-I/usr/include/ncursesw \
215
+	-I/usr/include/ncurses
216
+
170 217
 HOST_CONFIGURE_ARGS+= \
171 218
 	--without-cxx-main \
172 219
 	--without-pymalloc \
@@ -174,7 +221,7 @@ HOST_CONFIGURE_ARGS+= \
174 221
 	--prefix=$(STAGING_DIR_HOST) \
175 222
 	--with-ensurepip=upgrade \
176 223
 	CONFIG_SITE= \
177
-	OPT="$(HOST_CFLAGS)"
224
+	CFLAGS="$(HOST_CFLAGS)"
178 225
 
179 226
 define Host/Compile
180 227
 	+$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) python Parser/pgen
@@ -189,8 +236,15 @@ endef
189 236
 
190 237
 $(eval $(call HostBuild))
191 238
 
239
+$(foreach package, $(PYTHON3_PACKAGES),  \
240
+	$(eval $(call Py3Package,$(package))) \
241
+	$(eval $(call BuildPackage,$(package))) \
242
+)
243
+
192 244
 $(eval $(call Py3Package,python3-base))
245
+$(eval $(call Py3Package,python3-light))
193 246
 $(eval $(call Py3Package,python3))
194 247
 
195 248
 $(eval $(call BuildPackage,python3-base))
249
+$(eval $(call BuildPackage,python3-light))
196 250
 $(eval $(call BuildPackage,python3))

+ 16
- 0
lang/python3/files/python3-package-asyncio.mk Datei anzeigen

@@ -0,0 +1,16 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+define Package/python3-asyncio
9
+$(call Package/python3/Default)
10
+  TITLE:=Python $(PYTHON3_VERSION) asyncio module
11
+  DEPENDS:=+python3-light
12
+endef
13
+
14
+$(eval $(call Py3BasePackage,python3-asyncio, \
15
+	/usr/lib/python$(PYTHON3_VERSION)/asyncio \
16
+))

+ 23
- 0
lang/python3/files/python3-package-codecs.mk Datei anzeigen

@@ -0,0 +1,23 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+define Package/python3-codecs
9
+$(call Package/python3/Default)
10
+  TITLE:=Python $(PYTHON3_VERSION) codecs + unicode support
11
+  DEPENDS:=+python3-light
12
+endef
13
+
14
+$(eval $(call Py3BasePackage,python3-codecs, \
15
+	/usr/lib/python$(PYTHON3_VERSION)/encodings \
16
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_cn.$(PYTHON3_SO_SUFFIX) \
17
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_hk.$(PYTHON3_SO_SUFFIX) \
18
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_iso2022.$(PYTHON3_SO_SUFFIX) \
19
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_jp.$(PYTHON3_SO_SUFFIX) \
20
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_kr.$(PYTHON3_SO_SUFFIX) \
21
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_tw.$(PYTHON3_SO_SUFFIX) \
22
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/unicodedata.$(PYTHON3_SO_SUFFIX) \
23
+))

+ 18
- 0
lang/python3/files/python3-package-ctypes.mk Datei anzeigen

@@ -0,0 +1,18 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+define Package/python3-ctypes
9
+$(call Package/python3/Default)
10
+  TITLE:=Python $(PYTHON3_VERSION) ctypes module
11
+  DEPENDS:=+python3-light
12
+endef
13
+
14
+$(eval $(call Py3BasePackage,python3-ctypes, \
15
+	/usr/lib/python$(PYTHON3_VERSION)/ctypes \
16
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_ctypes.$(PYTHON3_SO_SUFFIX) \
17
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_ctypes_test.$(PYTHON3_SO_SUFFIX) \
18
+))

+ 17
- 0
lang/python3/files/python3-package-dbm.mk Datei anzeigen

@@ -0,0 +1,17 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+define Package/python3-dbm
9
+$(call Package/python3/Default)
10
+  TITLE:=Python $(PYTHON3_VERSION) dbm module
11
+  DEPENDS:=+python3-light +libdb47
12
+endef
13
+
14
+$(eval $(call Py3BasePackage,python3-dbm, \
15
+	/usr/lib/python$(PYTHON3_VERSION)/dbm \
16
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_dbm.$(PYTHON3_SO_SUFFIX) \
17
+))

+ 17
- 0
lang/python3/files/python3-package-decimal.mk Datei anzeigen

@@ -0,0 +1,17 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+define Package/python3-decimal
9
+$(call Package/python3/Default)
10
+  TITLE:=Python $(PYTHON3_VERSION) decimal module
11
+  DEPENDS:=+python3-light
12
+endef
13
+
14
+$(eval $(call Py3BasePackage,python3-decimal, \
15
+	/usr/lib/python$(PYTHON3_VERSION)/decimal.py \
16
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_decimal.$(PYTHON3_SO_SUFFIX) \
17
+))

+ 16
- 0
lang/python3/files/python3-package-distutils.mk Datei anzeigen

@@ -0,0 +1,16 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+define Package/python3-distutils
9
+$(call Package/python3/Default)
10
+  TITLE:=Python $(PYTHON3_VERSION) distutils module
11
+  DEPENDS:=+python3-light
12
+endef
13
+
14
+$(eval $(call Py3BasePackage,python3-distutils, \
15
+	/usr/lib/python$(PYTHON3_VERSION)/distutils \
16
+))

+ 16
- 0
lang/python3/files/python3-package-email.mk Datei anzeigen

@@ -0,0 +1,16 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+define Package/python3-email
9
+$(call Package/python3/Default)
10
+  TITLE:=Python $(PYTHON3_VERSION) email module
11
+  DEPENDS:=+python3-light
12
+endef
13
+
14
+$(eval $(call Py3BasePackage,python3-email, \
15
+	/usr/lib/python$(PYTHON3_VERSION)/email \
16
+))

+ 16
- 0
lang/python3/files/python3-package-gdbm.mk Datei anzeigen

@@ -0,0 +1,16 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+define Package/python3-gdbm
9
+$(call Package/python3/Default)
10
+  TITLE:=Python $(PYTHON3_VERSION) gdbm module
11
+  DEPENDS:=+python3-light +libgdbm
12
+endef
13
+
14
+$(eval $(call Py3BasePackage,python3-gdbm, \
15
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_gdbm.$(PYTHON3_SO_SUFFIX) \
16
+))

+ 16
- 0
lang/python3/files/python3-package-logging.mk Datei anzeigen

@@ -0,0 +1,16 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+define Package/python3-logging
9
+$(call Package/python3/Default)
10
+  TITLE:=Python $(PYTHON3_VERSION) logging module
11
+  DEPENDS:=+python3-light
12
+endef
13
+
14
+$(eval $(call Py3BasePackage,python3-logging, \
15
+	/usr/lib/python$(PYTHON3_VERSION)/logging \
16
+))

+ 17
- 0
lang/python3/files/python3-package-multiprocessing.mk Datei anzeigen

@@ -0,0 +1,17 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+define Package/python3-multiprocessing
9
+$(call Package/python3/Default)
10
+  TITLE:=Python $(PYTHON3_VERSION) multiprocessing
11
+  DEPENDS:=+python3-light
12
+endef
13
+
14
+$(eval $(call Py3BasePackage,python3-multiprocessing, \
15
+	/usr/lib/python$(PYTHON3_VERSION)/multiprocessing \
16
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_multiprocessing.$(PYTHON3_SO_SUFFIX) \
17
+))

+ 18
- 0
lang/python3/files/python3-package-ncurses.mk Datei anzeigen

@@ -0,0 +1,18 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+define Package/python3-ncurses
9
+$(call Package/python3/Default)
10
+  TITLE:=Python $(PYTHON3_VERSION) ncurses module
11
+  DEPENDS:=+python3-light +libncursesw
12
+endef
13
+
14
+$(eval $(call Py3BasePackage,python3-ncurses, \
15
+	/usr/lib/python$(PYTHON3_VERSION)/curses \
16
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_curses.$(PYTHON3_SO_SUFFIX) \
17
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_curses_panel.$(PYTHON3_SO_SUFFIX) \
18
+))

+ 17
- 0
lang/python3/files/python3-package-openssl.mk Datei anzeigen

@@ -0,0 +1,17 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+define Package/python3-openssl
9
+$(call Package/python3/Default)
10
+  TITLE:=Python $(PYTHON3_VERSION) SSL module
11
+  DEPENDS:=+python3-light +libopenssl
12
+endef
13
+
14
+$(eval $(call Py3BasePackage,python3-openssl, \
15
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_hashlib.$(PYTHON3_SO_SUFFIX) \
16
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_ssl.$(PYTHON3_SO_SUFFIX) \
17
+))

+ 18
- 0
lang/python3/files/python3-package-pydoc.mk Datei anzeigen

@@ -0,0 +1,18 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+define Package/python3-pydoc
9
+$(call Package/python3/Default)
10
+  TITLE:=Python $(PYTHON3_VERSION) pydoc module
11
+  DEPENDS:=+python3-light
12
+endef
13
+
14
+$(eval $(call Py3BasePackage,python3-pydoc, \
15
+	/usr/lib/python$(PYTHON3_VERSION)/doctest.py \
16
+	/usr/lib/python$(PYTHON3_VERSION)/pydoc.py \
17
+	/usr/lib/python$(PYTHON3_VERSION)/pydoc_data \
18
+))

+ 17
- 0
lang/python3/files/python3-package-sqlite3.mk Datei anzeigen

@@ -0,0 +1,17 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+define Package/python3-sqlite3
9
+$(call Package/python3/Default)
10
+  TITLE:=Python $(PYTHON3_VERSION) sqlite3 module
11
+  DEPENDS:=+python3-light +libsqlite3
12
+endef
13
+
14
+$(eval $(call Py3BasePackage,python3-sqlite3, \
15
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_sqlite3.$(PYTHON3_SO_SUFFIX) \
16
+	/usr/lib/python$(PYTHON3_VERSION)/sqlite3 \
17
+))

+ 16
- 0
lang/python3/files/python3-package-unittest.mk Datei anzeigen

@@ -0,0 +1,16 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+define Package/python3-unittest
9
+$(call Package/python3/Default)
10
+  TITLE:=Python $(PYTHON3_VERSION) unittest module
11
+  DEPENDS:=+python3-light
12
+endef
13
+
14
+$(eval $(call Py3BasePackage,python3-unittest, \
15
+	/usr/lib/python$(PYTHON3_VERSION)/unittest \
16
+))

+ 19
- 0
lang/python3/files/python3-package-xml.mk Datei anzeigen

@@ -0,0 +1,19 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+define Package/python3-xml
9
+$(call Package/python3/Default)
10
+  TITLE:=Python $(PYTHON3_VERSION) xml libs
11
+  DEPENDS:=+python3-light
12
+endef
13
+
14
+$(eval $(call Py3BasePackage,python3-xml, \
15
+	/usr/lib/python$(PYTHON3_VERSION)/xml \
16
+	/usr/lib/python$(PYTHON3_VERSION)/xmlrpc \
17
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_elementtree.$(PYTHON3_SO_SUFFIX) \
18
+	/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/pyexpat.$(PYTHON3_SO_SUFFIX) \
19
+))