summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3_3.5.6.bb
diff options
context:
space:
mode:
authorAnuj Mittal <anuj.mittal@intel.com>2018-09-12 17:44:11 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-09-13 07:42:28 +0100
commit55f36a4045b44e644887bc4316d6d3aae5d12e22 (patch)
tree0f082c7f9cac4d481c158eaa5604d4683d855e22 /meta/recipes-devtools/python/python3_3.5.6.bb
parent37be2ed7a94363b94cde413341a3795c9754994a (diff)
downloadpoky-55f36a4045b44e644887bc4316d6d3aae5d12e22.tar.gz
python3{,native}: update to 3.5.6
Includes changes: 76aa2c0a9a bpo-33216: Clarify the documentation for CALL_FUNCTION_* (#8338) 1b141b9553 Doc: Backport language switcher (bpo-33700, bpo-31045) (#8048) f381cfe07d [3.5] bpo-33001: Prevent buffer overrun in os.symlink (GH-5989) (#5991) 937ac1fe06 [3.5] bpo-32981: Fix catastrophic backtracking vulns (GH-5955) (#6034) (From OE-Core rev: e38ff96cc2217df403ea2c5abcd35d42969689d4) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python/python3_3.5.6.bb')
-rw-r--r--meta/recipes-devtools/python/python3_3.5.6.bb341
1 files changed, 341 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3_3.5.6.bb b/meta/recipes-devtools/python/python3_3.5.6.bb
new file mode 100644
index 0000000000..13599c9216
--- /dev/null
+++ b/meta/recipes-devtools/python/python3_3.5.6.bb
@@ -0,0 +1,341 @@
1require recipes-devtools/python/python.inc
2
3DEPENDS = "python3-native libffi bzip2 gdbm openssl \
4 sqlite3 zlib virtual/libintl xz qemu-native \
5 qemu-helper-native virtual/crypt"
6
7PR = "${INC_PR}.0"
8PYTHON_MAJMIN = "3.5"
9PYTHON_BINABI = "${PYTHON_MAJMIN}m"
10DISTRO_SRC_URI ?= "file://sitecustomize.py"
11DISTRO_SRC_URI_linuxstdbase = ""
12SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
13file://python-config.patch \
14file://030-fixup-include-dirs.patch \
15file://070-dont-clean-ipkg-install.patch \
16file://080-distutils-dont_adjust_files.patch \
17file://130-readline-setup.patch \
18file://150-fix-setupterm.patch \
19file://0001-h2py-Fix-issue-13032-where-it-fails-with-UnicodeDeco.patch \
20file://tweak-MULTIARCH-for-powerpc-linux-gnuspe.patch \
21file://support_SOURCE_DATE_EPOCH_in_py_compile.patch \
22${DISTRO_SRC_URI} \
23"
24
25SRC_URI += "\
26 file://03-fix-tkinter-detection.patch \
27 file://avoid_warning_about_tkinter.patch \
28 file://cgi_py.patch \
29 file://host_include_contamination.patch \
30 file://python-3.3-multilib.patch \
31 file://sysroot-include-headers.patch \
32 file://unixccompiler.patch \
33 file://avoid-ncursesw-include-path.patch \
34 file://python3-use-CROSSPYTHONPATH-for-PYTHON_FOR_BUILD.patch \
35 file://sysconfig.py-add-_PYTHON_PROJECT_SRC.patch \
36 file://setup.py-check-cross_compiling-when-get-FLAGS.patch \
37 file://configure.ac-fix-LIBPL.patch \
38 file://0001-Issue-21272-Use-_sysconfigdata.py-to-initialize-dist.patch \
39 file://pass-missing-libraries-to-Extension-for-mul.patch \
40 file://Use-correct-CFLAGS-for-extensions-when-cross-compili.patch \
41 file://0002-Makefile-add-target-to-split-profile-generation.patch \
42 file://float-endian.patch \
43 file://ftplib.patch \
44 file://signal.patch \
45 "
46SRC_URI[md5sum] = "f5a99f765e765336a3ebbb2a24ca2be3"
47SRC_URI[sha256sum] = "f55cde04f521f273c7cba08912921cc5642cfc15ca7b22d5829f0aff4371155f"
48
49LIC_FILES_CHKSUM = "file://LICENSE;md5=b6ec515b22618f55fa07276b897bacea"
50
51# exclude pre-releases for both python 2.x and 3.x
52UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar"
53
54S = "${WORKDIR}/Python-${PV}"
55
56inherit autotools multilib_header python3native pkgconfig update-alternatives qemu
57
58MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
59
60ALTERNATIVE_${PN}-dev = "python-config"
61ALTERNATIVE_LINK_NAME[python-config] = "${bindir}/python${PYTHON_BINABI}-config"
62ALTERNATIVE_TARGET[python-config] = "${bindir}/python${PYTHON_BINABI}-config-${MULTILIB_SUFFIX}"
63
64CONFIGUREOPTS += " --with-system-ffi "
65
66CACHED_CONFIGUREVARS = "ac_cv_have_chflags=no \
67 ac_cv_have_lchflags=no \
68 ac_cv_have_long_long_format=yes \
69 ac_cv_buggy_getaddrinfo=no \
70 ac_cv_file__dev_ptmx=yes \
71 ac_cv_file__dev_ptc=no \
72"
73
74TARGET_CC_ARCH += "-DNDEBUG -fno-inline"
75SDK_CC_ARCH += "-DNDEBUG -fno-inline"
76EXTRA_OEMAKE += "CROSS_COMPILE=yes"
77EXTRA_OECONF += "CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ --without-ensurepip"
78
79PYTHON3_PROFILE_TASK ?= "./python -m test.regrtest --pgo test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_support || true"
80
81export CROSS_COMPILE = "${TARGET_PREFIX}"
82export _PYTHON_PROJECT_BASE = "${B}"
83export _PYTHON_PROJECT_SRC = "${S}"
84export CCSHARED = "-fPIC"
85
86# Fix cross compilation of different modules
87export CROSSPYTHONPATH = "${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/:${B}/build/lib.linux-${TARGET_ARCH}-${PYTHON_MAJMIN}:${S}/Lib:${S}/Lib/plat-linux"
88
89# No ctypes option for python 3
90PYTHONLSBOPTS = ""
91
92PACKAGECONFIG ??= "readline ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'pgo', '', d)}"
93PACKAGECONFIG[readline] = ",,readline"
94# Use profile guided optimisation by running PyBench inside qemu-user
95PACKAGECONFIG[pgo] = "--enable-optimizations"
96
97do_configure_append() {
98 rm -f ${S}/Makefile.orig
99 autoreconf -Wcross --verbose --install --force --exclude=autopoint ../Python-${PV}/Modules/_ctypes/libffi
100}
101
102run_make() {
103 oe_runmake PGEN=${STAGING_BINDIR_NATIVE}/python3-native/pgen \
104 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python3-native/python3 \
105 STAGING_LIBDIR=${STAGING_LIBDIR} \
106 STAGING_INCDIR=${STAGING_INCDIR} \
107 STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
108 LIB=${baselib} \
109 ARCH=${TARGET_ARCH} \
110 OPT="${CFLAGS}" \
111 "$@"
112}
113
114do_compile() {
115 # regenerate platform specific files, because they depend on system headers
116 cd ${S}/Lib/plat-linux*
117 include=${STAGING_INCDIR} ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
118 ${S}/Tools/scripts/h2py.py -i '(u_long)' \
119 ${STAGING_INCDIR}/dlfcn.h \
120 ${STAGING_INCDIR}/linux/cdrom.h \
121 ${STAGING_INCDIR}/netinet/in.h \
122 ${STAGING_INCDIR}/sys/types.h
123 sed -e 's,${STAGING_DIR_HOST},,g' -i *.py
124 cd -
125
126 # remove any bogus LD_LIBRARY_PATH
127 sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile
128
129 if [ ! -f Makefile.orig ]; then
130 install -m 0644 Makefile Makefile.orig
131 fi
132 sed -i -e 's,^CONFIGURE_LDFLAGS=.*,CONFIGURE_LDFLAGS=-L. -L${STAGING_LIBDIR},g' \
133 -e 's,libdir=${libdir},libdir=${STAGING_LIBDIR},g' \
134 -e 's,libexecdir=${libexecdir},libexecdir=${STAGING_DIR_HOST}${libexecdir},g' \
135 -e 's,^LIBDIR=.*,LIBDIR=${STAGING_LIBDIR},g' \
136 -e 's,includedir=${includedir},includedir=${STAGING_INCDIR},g' \
137 -e 's,^INCLUDEDIR=.*,INCLUDE=${STAGING_INCDIR},g' \
138 -e 's,^CONFINCLUDEDIR=.*,CONFINCLUDE=${STAGING_INCDIR},g' \
139 Makefile
140 # save copy of it now, because if we do it in do_install and
141 # then call do_install twice we get Makefile.orig == Makefile.sysroot
142 install -m 0644 Makefile Makefile.sysroot
143
144 if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then
145 run_make profile-opt
146 qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}"
147 cat >pgo-wrapper <<EOF
148#!/bin/sh
149cd ${B}
150$qemu_binary "\$@"
151EOF
152 chmod +x pgo-wrapper
153 bbnote Gathering profiling data
154 ./pgo-wrapper ${PYTHON3_PROFILE_TASK}
155 bbnote Profiling data gathered, rebuilding
156 run_make clean_and_use_profile
157 else
158 run_make libpython3.so
159 run_make
160 fi
161}
162
163do_install() {
164 # make install needs the original Makefile, or otherwise the inclues would
165 # go to ${D}${STAGING...}/...
166 install -m 0644 Makefile.orig Makefile
167
168 install -d ${D}${libdir}/pkgconfig
169 install -d ${D}${libdir}/python${PYTHON_MAJMIN}/config
170
171 # rerun the build once again with original makefile this time
172 # run install in a separate step to avoid compile/install race
173 if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then
174 run_make DESTDIR=${D} LIBDIR=${libdir} build_all_use_profile
175 else
176 run_make DESTDIR=${D} LIBDIR=${libdir}
177 fi
178
179 run_make DESTDIR=${D} LIBDIR=${libdir} install
180
181 # avoid conflict with 2to3 from Python 2
182 rm -f ${D}/${bindir}/2to3
183
184 install -m 0644 Makefile.sysroot ${D}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
185 install -m 0644 Makefile.sysroot ${D}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}/Makefile
186
187 if [ -e ${WORKDIR}/sitecustomize.py ]; then
188 install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN}
189 fi
190
191 oe_multilib_header python${PYTHON_BINABI}/pyconfig.h
192}
193
194do_install_append_class-nativesdk () {
195 create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1'
196}
197
198SSTATE_SCAN_FILES += "Makefile"
199PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
200
201py_package_preprocess () {
202 # copy back the old Makefile to fix target package
203 install -m 0644 ${B}/Makefile.orig ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
204 install -m 0644 ${B}/Makefile.orig ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}/Makefile
205 # Remove references to buildmachine paths in target Makefile and _sysconfigdata
206 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
207 -e 's|${DEBUG_PREFIX_MAP}||g' \
208 -e 's:${HOSTTOOLS_DIR}/::g' \
209 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
210 -e 's:${RECIPE_SYSROOT}::g' \
211 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
212 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile \
213 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}/Makefile \
214 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py \
215 ${PKGD}/${bindir}/python${PYTHON_BINABI}-config
216
217 # Recompile _sysconfigdata after modifying it
218 cd ${PKGD}
219 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} \
220 -c "from py_compile import compile; compile('./${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py')"
221 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} \
222 -c "from py_compile import compile; compile('./${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py', optimize=1)"
223 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} \
224 -c "from py_compile import compile; compile('./${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py', optimize=2)"
225 cd -
226
227 mv ${PKGD}/${bindir}/python3.5m-config ${PKGD}/${bindir}/python3.5m-config-${MULTILIB_SUFFIX}
228}
229
230# manual dependency additions
231RPROVIDES_${PN}-modules = "${PN}"
232RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python3-modules"
233RRECOMMENDS_${PN}-crypt = "openssl"
234RRECOMMENDS_${PN}-crypt_class-nativesdk = "nativesdk-openssl"
235
236FILES_${PN}-2to3 += "${bindir}/2to3-${PYTHON_MAJMIN}"
237FILES_${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3"
238FILES_${PN}-idle += "${bindir}/idle3 ${bindir}/idle${PYTHON_MAJMIN}"
239
240PACKAGES =+ "${PN}-pyvenv"
241FILES_${PN}-pyvenv += "${bindir}/pyvenv-${PYTHON_MAJMIN} ${bindir}/pyvenv"
242
243# package libpython3
244PACKAGES =+ "libpython3 libpython3-staticdev"
245FILES_libpython3 = "${libdir}/libpython*.so.*"
246FILES_libpython3-staticdev += "${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_BINABI}/libpython${PYTHON_BINABI}.a"
247INSANE_SKIP_${PN}-dev += "dev-elf"
248
249# catch all the rest (unsorted)
250PACKAGES += "${PN}-misc"
251RDEPENDS_${PN}-misc += "${PN}-core ${PN}-email ${PN}-codecs"
252RDEPENDS_${PN}-modules += "${PN}-misc"
253FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN}"
254
255# catch manpage
256PACKAGES += "${PN}-man"
257FILES_${PN}-man = "${datadir}/man"
258
259BBCLASSEXTEND = "nativesdk"
260
261RPROVIDES_${PN} += "${PN}-modules"
262
263# We want bytecode precompiled .py files (.pyc's) by default
264# but the user may set it on their own conf
265INCLUDE_PYCS ?= "1"
266
267python(){
268 import json
269
270 filename = os.path.join(d.getVar('THISDIR'), 'python3', 'python3-manifest.json')
271 # This python changes the datastore based on the contents of a file, so mark
272 # that dependency.
273 bb.parse.mark_dependency(d, filename)
274
275 with open(filename) as manifest_file:
276 python_manifest=json.load(manifest_file)
277
278 include_pycs = d.getVar('INCLUDE_PYCS')
279
280 packages = d.getVar('PACKAGES').split()
281 pn = d.getVar('PN')
282
283 newpackages=[]
284 for key in python_manifest:
285 pypackage= pn + '-' + key
286
287 if pypackage not in packages:
288 # We need to prepend, otherwise python-misc gets everything
289 # so we use a new variable
290 newpackages.append(pypackage)
291
292 # "Build" python's manifest FILES, RDEPENDS and SUMMARY
293 d.setVar('FILES_' + pypackage, '')
294 for value in python_manifest[key]['files']:
295 d.appendVar('FILES_' + pypackage, ' ' + value)
296
297 # Add cached files
298 if include_pycs == '1':
299 for value in python_manifest[key]['cached']:
300 d.appendVar('FILES_' + pypackage, ' ' + value)
301
302 d.setVar('RDEPENDS_' + pypackage, '')
303 for value in python_manifest[key]['rdepends']:
304 # Make it work with or without $PN
305 if '${PN}' in value:
306 value=value.split('-')[1]
307 d.appendVar('RDEPENDS_' + pypackage, ' ' + pn + '-' + value)
308 d.setVar('SUMMARY_' + pypackage, python_manifest[key]['summary'])
309
310 # We need to ensure staticdev packages match for files first so we sort in reverse
311 newpackages.sort(reverse=True)
312 # Prepending so to avoid python-misc getting everything
313 packages = newpackages + packages
314 d.setVar('PACKAGES', ' '.join(packages))
315 d.setVar('ALLOW_EMPTY_${PN}-modules', '1')
316}
317
318# Files needed to create a new manifest
319SRC_URI += "file://create_manifest3.py file://get_module_deps3.py file://python3-manifest.json"
320
321do_create_manifest() {
322 # This task should be run with every new release of Python.
323 # We must ensure that PACKAGECONFIG enables everything when creating
324 # a new manifest, this is to base our new manifest on a complete
325 # native python build, containing all dependencies, otherwise the task
326 # wont be able to find the required files.
327 # e.g. BerkeleyDB is an optional build dependency so it may or may not
328 # be present, we must ensure it is.
329
330 cd ${WORKDIR}
331 # This needs to be executed by python-native and NOT by HOST's python
332 nativepython3 create_manifest3.py ${PYTHON_MAJMIN}
333 cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json
334}
335
336# bitbake python -c create_manifest
337addtask do_create_manifest
338
339# Make sure we have native python ready when we create a new manifest
340do_create_manifest[depends] += "python3:do_prepare_recipe_sysroot"
341do_create_manifest[depends] += "python3:do_patch"