diff options
Diffstat (limited to 'meta/recipes-devtools/python/python3_3.11.4.bb')
-rw-r--r-- | meta/recipes-devtools/python/python3_3.11.4.bb | 443 |
1 files changed, 443 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3_3.11.4.bb b/meta/recipes-devtools/python/python3_3.11.4.bb new file mode 100644 index 0000000000..6b074c48cf --- /dev/null +++ b/meta/recipes-devtools/python/python3_3.11.4.bb | |||
@@ -0,0 +1,443 @@ | |||
1 | SUMMARY = "The Python Programming Language" | ||
2 | HOMEPAGE = "http://www.python.org" | ||
3 | DESCRIPTION = "Python is a programming language that lets you work more quickly and integrate your systems more effectively." | ||
4 | LICENSE = "PSF-2.0" | ||
5 | SECTION = "devel/python" | ||
6 | |||
7 | LIC_FILES_CHKSUM = "file://LICENSE;md5=fcf6b249c2641540219a727f35d8d2c2" | ||
8 | |||
9 | SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \ | ||
10 | file://run-ptest \ | ||
11 | file://create_manifest3.py \ | ||
12 | file://get_module_deps3.py \ | ||
13 | file://python3-manifest.json \ | ||
14 | file://check_build_completeness.py \ | ||
15 | file://reformat_sysconfig.py \ | ||
16 | file://cgi_py.patch \ | ||
17 | file://0001-Do-not-add-usr-lib-termcap-to-linker-flags-to-avoid-.patch \ | ||
18 | ${@bb.utils.contains('PACKAGECONFIG', 'tk', '', 'file://avoid_warning_about_tkinter.patch', d)} \ | ||
19 | file://0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch \ | ||
20 | file://0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch \ | ||
21 | file://crosspythonpath.patch \ | ||
22 | file://0001-test_locale.py-correct-the-test-output-format.patch \ | ||
23 | file://0017-setup.py-do-not-report-missing-dependencies-for-disa.patch \ | ||
24 | file://0001-Makefile-do-not-compile-.pyc-in-parallel.patch \ | ||
25 | file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \ | ||
26 | file://0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch \ | ||
27 | file://0001-test_ctypes.test_find-skip-without-tools-sdk.patch \ | ||
28 | file://makerace.patch \ | ||
29 | file://0001-sysconfig.py-use-platlibdir-also-for-purelib.patch \ | ||
30 | file://0001-Lib-pty.py-handle-stdin-I-O-errors-same-way-as-maste.patch \ | ||
31 | file://0001-setup.py-Do-not-detect-multiarch-paths-when-cross-co.patch \ | ||
32 | file://deterministic_imports.patch \ | ||
33 | file://0001-Avoid-shebang-overflow-on-python-config.py.patch \ | ||
34 | file://0001-Update-test_sysconfig-for-posix_user-purelib.patch \ | ||
35 | " | ||
36 | |||
37 | SRC_URI:append:class-native = " \ | ||
38 | file://0001-Lib-sysconfig.py-use-prefix-value-from-build-configu.patch \ | ||
39 | file://12-distutils-prefix-is-inside-staging-area.patch \ | ||
40 | file://0001-Don-t-search-system-for-headers-libraries.patch \ | ||
41 | " | ||
42 | SRC_URI[sha256sum] = "2f0e409df2ab57aa9fc4cbddfb976af44e4e55bf6f619eee6bc5c2297264a7f6" | ||
43 | |||
44 | # exclude pre-releases for both python 2.x and 3.x | ||
45 | UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar" | ||
46 | UPSTREAM_CHECK_URI = "https://www.python.org/downloads/source/" | ||
47 | |||
48 | CVE_PRODUCT = "python" | ||
49 | |||
50 | # Upstream consider this expected behaviour | ||
51 | CVE_CHECK_IGNORE += "CVE-2007-4559" | ||
52 | # This is not exploitable when glibc has CVE-2016-10739 fixed. | ||
53 | CVE_CHECK_IGNORE += "CVE-2019-18348" | ||
54 | # These are specific to Microsoft Windows | ||
55 | CVE_CHECK_IGNORE += "CVE-2020-15523 CVE-2022-26488" | ||
56 | # The mailcap module is insecure by design, so this can't be fixed in a meaningful way. | ||
57 | # The module will be removed in the future and flaws documented. | ||
58 | CVE_CHECK_IGNORE += "CVE-2015-20107" | ||
59 | |||
60 | PYTHON_MAJMIN = "3.11" | ||
61 | |||
62 | S = "${WORKDIR}/Python-${PV}" | ||
63 | |||
64 | BBCLASSEXTEND = "native nativesdk" | ||
65 | |||
66 | inherit autotools pkgconfig qemu ptest multilib_header update-alternatives | ||
67 | |||
68 | MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}" | ||
69 | |||
70 | ALTERNATIVE:${PN}-dev = "python3-config" | ||
71 | ALTERNATIVE_LINK_NAME[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config" | ||
72 | ALTERNATIVE_TARGET[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}" | ||
73 | |||
74 | |||
75 | DEPENDS = "bzip2-replacement-native expat libffi bzip2 openssl sqlite3 zlib virtual/libintl xz virtual/crypt util-linux-libuuid libtirpc libnsl2 autoconf-archive-native ncurses" | ||
76 | DEPENDS:append:class-target = " python3-native" | ||
77 | DEPENDS:append:class-nativesdk = " python3-native" | ||
78 | |||
79 | EXTRA_OECONF = " --without-ensurepip --enable-shared --with-platlibdir=${baselib} --with-system-expat" | ||
80 | EXTRA_OECONF:append:class-native = " --bindir=${bindir}/${PN}" | ||
81 | EXTRA_OECONF:append:class-target = " --with-build-python=nativepython3" | ||
82 | EXTRA_OECONF:append:class-nativesdk = " --with-build-python=nativepython3" | ||
83 | |||
84 | export CROSSPYTHONPATH="${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/" | ||
85 | |||
86 | EXTRANATIVEPATH += "python3-native" | ||
87 | |||
88 | # LTO will be enabled via packageconfig depending upong distro features | ||
89 | LTO:class-target = "" | ||
90 | |||
91 | CACHED_CONFIGUREVARS = " \ | ||
92 | ac_cv_file__dev_ptmx=yes \ | ||
93 | ac_cv_file__dev_ptc=no \ | ||
94 | ac_cv_working_tzset=yes \ | ||
95 | " | ||
96 | |||
97 | # PGO currently causes builds to not be reproducible so disable by default, see YOCTO #13407 | ||
98 | PACKAGECONFIG ??= "editline gdbm ${@bb.utils.filter('DISTRO_FEATURES', 'lto', d)}" | ||
99 | PACKAGECONFIG[readline] = "--with-readline=readline,,readline,,,editline" | ||
100 | PACKAGECONFIG[editline] = "--with-readline=editline,,libedit,,,readline" | ||
101 | # Use profile guided optimisation by running PyBench inside qemu-user | ||
102 | PACKAGECONFIG[pgo] = "--enable-optimizations,,qemu-native" | ||
103 | PACKAGECONFIG[tk] = ",,tk" | ||
104 | PACKAGECONFIG[tcl] = ",,tcl" | ||
105 | PACKAGECONFIG[gdbm] = ",,gdbm" | ||
106 | PACKAGECONFIG[lto] = "--with-lto,--without-lto" | ||
107 | |||
108 | do_configure:prepend () { | ||
109 | mkdir -p ${B}/Modules | ||
110 | cat > ${B}/Modules/Setup.local << EOF | ||
111 | *disabled* | ||
112 | ${@bb.utils.contains('PACKAGECONFIG', 'gdbm', '', '_gdbm _dbm', d)} | ||
113 | ${@bb.utils.contains('PACKAGECONFIG', 'readline', '', 'readline', d)} | ||
114 | EOF | ||
115 | } | ||
116 | |||
117 | CPPFLAGS:append = " -I${STAGING_INCDIR}/ncursesw -I${STAGING_INCDIR}/uuid" | ||
118 | |||
119 | EXTRA_OEMAKE = '\ | ||
120 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
121 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
122 | LIB=${baselib} \ | ||
123 | ' | ||
124 | |||
125 | do_compile:prepend:class-target() { | ||
126 | if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then | ||
127 | qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}" | ||
128 | cat >pgo-wrapper <<EOF | ||
129 | #!/bin/sh | ||
130 | cd ${B} | ||
131 | $qemu_binary "\$@" | ||
132 | EOF | ||
133 | chmod +x pgo-wrapper | ||
134 | fi | ||
135 | } | ||
136 | |||
137 | do_install:prepend() { | ||
138 | ${WORKDIR}/check_build_completeness.py ${T}/log.do_compile | ||
139 | } | ||
140 | |||
141 | do_install:append:class-target() { | ||
142 | oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h | ||
143 | } | ||
144 | |||
145 | do_install:append:class-native() { | ||
146 | # Make sure we use /usr/bin/env python | ||
147 | for PYTHSCRIPT in `grep -rIl ${bindir}/${PN}/python ${D}${bindir}/${PN}`; do | ||
148 | sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT | ||
149 | done | ||
150 | # Add a symlink to the native Python so that scripts can just invoke | ||
151 | # "nativepython" and get the right one without needing absolute paths | ||
152 | # (these often end up too long for the #! parser in the kernel as the | ||
153 | # buffer is 128 bytes long). | ||
154 | ln -s python3-native/python3 ${D}${bindir}/nativepython3 | ||
155 | |||
156 | # Remove the opt-1.pyc and opt-2.pyc files. There are over 3,000 of them | ||
157 | # and the overhead in each recipe-sysroot-native isn't worth it, particularly | ||
158 | # when they're only used for python called with -O or -OO. | ||
159 | #find ${D} -name *opt-*.pyc -delete | ||
160 | # Remove all pyc files. There are a ton of them and it is probably faster to let | ||
161 | # python create the ones it wants at runtime rather than manage in the sstate | ||
162 | # tarballs and sysroot creation. | ||
163 | find ${D} -name *.pyc -delete | ||
164 | |||
165 | # Nothing should be looking into ${B} for python3-native | ||
166 | sed -i -e 's:${B}:/build/path/unavailable/:g' \ | ||
167 | ${D}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile | ||
168 | |||
169 | # disable the lookup in user's site-packages globally | ||
170 | sed -i 's#ENABLE_USER_SITE = None#ENABLE_USER_SITE = False#' ${D}${libdir}/python${PYTHON_MAJMIN}/site.py | ||
171 | |||
172 | # python3-config needs to be in /usr/bin and not in a subdir of it to work properly | ||
173 | mv ${D}/${bindir}/${PN}/python*config ${D}/${bindir}/ | ||
174 | } | ||
175 | |||
176 | do_install:append() { | ||
177 | for c in ${D}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do | ||
178 | python3 ${WORKDIR}/reformat_sysconfig.py $c | ||
179 | done | ||
180 | rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/__pycache__/_sysconfigdata*.cpython* | ||
181 | |||
182 | mkdir -p ${D}${libdir}/python-sysconfigdata | ||
183 | sysconfigfile=`find ${D} -name _sysconfig*.py` | ||
184 | sed -i \ | ||
185 | -e "s,^ 'LIBDIR'.*, 'LIBDIR': '${STAGING_LIBDIR}'\,,g" \ | ||
186 | -e "s,^ 'INCLUDEDIR'.*, 'INCLUDEDIR': '${STAGING_INCDIR}'\,,g" \ | ||
187 | -e "s,^ 'CONFINCLUDEDIR'.*, 'CONFINCLUDEDIR': '${STAGING_INCDIR}'\,,g" \ | ||
188 | -e "s,^ 'INCLUDEPY'.*, 'INCLUDEPY': '${STAGING_INCDIR}/python${PYTHON_MAJMIN}'\,,g" \ | ||
189 | -e "s,^ 'CONFINCLUDEPY'.*, 'CONFINCLUDEPY': '${STAGING_INCDIR}/python${PYTHON_MAJMIN}'\,,g" \ | ||
190 | -e "s,${B},/build/path/unavailable/,g" \ | ||
191 | $sysconfigfile | ||
192 | cp $sysconfigfile ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py | ||
193 | |||
194 | |||
195 | # Unfortunately the following pyc files are non-deterministc due to 'frozenset' | ||
196 | # being written without strict ordering, even with PYTHONHASHSEED = 0 | ||
197 | # Upstream is discussing ways to solve the issue properly, until then let's | ||
198 | # just not install the problematic files. | ||
199 | # More info: http://benno.id.au/blog/2013/01/15/python-determinism | ||
200 | rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_range.cpython* | ||
201 | rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_xml_etree.cpython* | ||
202 | |||
203 | # Similar to the above, we're getting reproducibility issues with | ||
204 | # /usr/lib/python3.10/__pycache__/traceback.cpython-310.pyc | ||
205 | # so remove it too | ||
206 | rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/__pycache__/traceback.cpython* | ||
207 | |||
208 | # Remove the opt-1.pyc and opt-2.pyc files. They effectively waste space on embedded | ||
209 | # style targets as they're only used when python is called with the -O or -OO options | ||
210 | # which is rare. | ||
211 | find ${D} -name *opt-*.pyc -delete | ||
212 | } | ||
213 | |||
214 | do_install:append:class-nativesdk () { | ||
215 | # Make sure we use /usr/bin/env python | ||
216 | for PYTHSCRIPT in `grep -rIl ${bindir}/python ${D}${bindir}`; do | ||
217 | sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT | ||
218 | done | ||
219 | create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1' | ||
220 | } | ||
221 | |||
222 | SYSROOT_PREPROCESS_FUNCS:append:class-target = " provide_target_config_script" | ||
223 | SYSROOT_PREPROCESS_FUNCS:append:class-nativesdk = " provide_target_config_script" | ||
224 | |||
225 | # This is installed into /usr/python-target-config/ and not /usr/bin | ||
226 | # because adding target sysroot's /usr/bin/ to PATH has unwanted side effects | ||
227 | # in components erroneously picking up other target executables from it | ||
228 | provide_target_config_script() { | ||
229 | install -d ${SYSROOT_DESTDIR}${prefix}/python-target-config/ | ||
230 | install ${D}/${bindir}/python3-config ${SYSROOT_DESTDIR}/${prefix}/python-target-config/ | ||
231 | install ${D}/${bindir}/python${PYTHON_MAJMIN}-config ${SYSROOT_DESTDIR}/${prefix}/python-target-config/ | ||
232 | } | ||
233 | SYSROOT_DIRS += "${prefix}/python-target-config/" | ||
234 | |||
235 | SSTATE_SCAN_FILES += "Makefile _sysconfigdata.py" | ||
236 | SSTATE_HASHEQUIV_FILEMAP = " \ | ||
237 | populate_sysroot:*/lib*/python3*/_sysconfigdata*.py:${TMPDIR} \ | ||
238 | populate_sysroot:*/lib*/python3*/_sysconfigdata*.py:${COREBASE} \ | ||
239 | populate_sysroot:*/lib*/python3*/config-*/Makefile:${TMPDIR} \ | ||
240 | populate_sysroot:*/lib*/python3*/config-*/Makefile:${COREBASE} \ | ||
241 | populate_sysroot:*/lib*/python-sysconfigdata/_sysconfigdata.py:${TMPDIR} \ | ||
242 | populate_sysroot:*/lib*/python-sysconfigdata/_sysconfigdata.py:${COREBASE} \ | ||
243 | " | ||
244 | PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess" | ||
245 | |||
246 | py_package_preprocess () { | ||
247 | # Remove references to buildmachine paths in target Makefile and _sysconfigdata | ||
248 | sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \ | ||
249 | -e 's|${DEBUG_PREFIX_MAP}||g' \ | ||
250 | -e 's:${HOSTTOOLS_DIR}/::g' \ | ||
251 | -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ | ||
252 | -e 's:${RECIPE_SYSROOT}::g' \ | ||
253 | -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ | ||
254 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile \ | ||
255 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py \ | ||
256 | ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config | ||
257 | |||
258 | # Reformat _sysconfigdata after modifying it so that it remains | ||
259 | # reproducible | ||
260 | for c in ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do | ||
261 | python3 ${WORKDIR}/reformat_sysconfig.py $c | ||
262 | done | ||
263 | |||
264 | # Recompile _sysconfigdata after modifying it | ||
265 | cd ${PKGD} | ||
266 | sysconfigfile=`find . -name _sysconfigdata_*.py` | ||
267 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ | ||
268 | -c "from py_compile import compile; compile('$sysconfigfile')" | ||
269 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ | ||
270 | -c "from py_compile import compile; compile('$sysconfigfile', optimize=1)" | ||
271 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ | ||
272 | -c "from py_compile import compile; compile('$sysconfigfile', optimize=2)" | ||
273 | cd - | ||
274 | |||
275 | mv ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX} | ||
276 | |||
277 | #Remove the unneeded copy of target sysconfig data | ||
278 | rm -rf ${PKGD}/${libdir}/python-sysconfigdata | ||
279 | } | ||
280 | |||
281 | # We want bytecode precompiled .py files (.pyc's) by default | ||
282 | # but the user may set it on their own conf | ||
283 | INCLUDE_PYCS ?= "1" | ||
284 | |||
285 | python(){ | ||
286 | import collections, json | ||
287 | |||
288 | filename = os.path.join(d.getVar('THISDIR'), 'python3', 'python3-manifest.json') | ||
289 | # This python changes the datastore based on the contents of a file, so mark | ||
290 | # that dependency. | ||
291 | bb.parse.mark_dependency(d, filename) | ||
292 | |||
293 | with open(filename) as manifest_file: | ||
294 | manifest_str = manifest_file.read() | ||
295 | json_start = manifest_str.find('# EOC') + 6 | ||
296 | manifest_file.seek(json_start) | ||
297 | manifest_str = manifest_file.read() | ||
298 | python_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict) | ||
299 | |||
300 | # First set RPROVIDES for -native case | ||
301 | # Hardcoded since it cant be python3-native-foo, should be python3-foo-native | ||
302 | pn = 'python3' | ||
303 | rprovides = (d.getVar('RPROVIDES') or "").split() | ||
304 | |||
305 | # ${PN}-misc-native is not in the manifest | ||
306 | rprovides.append(pn + '-misc-native') | ||
307 | |||
308 | for key in python_manifest: | ||
309 | pypackage = pn + '-' + key + '-native' | ||
310 | if pypackage not in rprovides: | ||
311 | rprovides.append(pypackage) | ||
312 | |||
313 | d.setVar('RPROVIDES:class-native', ' '.join(rprovides)) | ||
314 | |||
315 | # Then work on the target | ||
316 | include_pycs = d.getVar('INCLUDE_PYCS') | ||
317 | |||
318 | packages = d.getVar('PACKAGES').split() | ||
319 | pn = d.getVar('PN') | ||
320 | |||
321 | newpackages=[] | ||
322 | for key in python_manifest: | ||
323 | pypackage = pn + '-' + key | ||
324 | |||
325 | if pypackage not in packages: | ||
326 | # We need to prepend, otherwise python-misc gets everything | ||
327 | # so we use a new variable | ||
328 | newpackages.append(pypackage) | ||
329 | |||
330 | # "Build" python's manifest FILES, RDEPENDS and SUMMARY | ||
331 | d.setVar('FILES:' + pypackage, '') | ||
332 | for value in python_manifest[key]['files']: | ||
333 | d.appendVar('FILES:' + pypackage, ' ' + value) | ||
334 | |||
335 | # Add cached files | ||
336 | if include_pycs == '1': | ||
337 | for value in python_manifest[key]['cached']: | ||
338 | d.appendVar('FILES:' + pypackage, ' ' + value) | ||
339 | |||
340 | for value in python_manifest[key]['rdepends']: | ||
341 | # Make it work with or without $PN | ||
342 | if '${PN}' in value: | ||
343 | value=value.split('-', 1)[1] | ||
344 | d.appendVar('RDEPENDS:' + pypackage, ' ' + pn + '-' + value) | ||
345 | |||
346 | for value in python_manifest[key].get('rrecommends', ()): | ||
347 | if '${PN}' in value: | ||
348 | value=value.split('-', 1)[1] | ||
349 | d.appendVar('RRECOMMENDS:' + pypackage, ' ' + pn + '-' + value) | ||
350 | |||
351 | d.setVar('SUMMARY:' + pypackage, python_manifest[key]['summary']) | ||
352 | |||
353 | # Prepending so to avoid python-misc getting everything | ||
354 | packages = newpackages + packages | ||
355 | d.setVar('PACKAGES', ' '.join(packages)) | ||
356 | d.setVar('ALLOW_EMPTY:${PN}-modules', '1') | ||
357 | d.setVar('ALLOW_EMPTY:${PN}-pkgutil', '1') | ||
358 | |||
359 | if "pgo" in d.getVar("PACKAGECONFIG").split() and not bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', True, False, d): | ||
360 | bb.fatal("pgo cannot be enabled as there is no qemu-usermode support for this architecture/machine") | ||
361 | } | ||
362 | |||
363 | # Files needed to create a new manifest | ||
364 | |||
365 | do_create_manifest() { | ||
366 | # This task should be run with every new release of Python. | ||
367 | # We must ensure that PACKAGECONFIG enables everything when creating | ||
368 | # a new manifest, this is to base our new manifest on a complete | ||
369 | # native python build, containing all dependencies, otherwise the task | ||
370 | # wont be able to find the required files. | ||
371 | # e.g. BerkeleyDB is an optional build dependency so it may or may not | ||
372 | # be present, we must ensure it is. | ||
373 | |||
374 | cd ${WORKDIR} | ||
375 | # This needs to be executed by python-native and NOT by HOST's python | ||
376 | nativepython3 create_manifest3.py ${PYTHON_MAJMIN} | ||
377 | cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json | ||
378 | } | ||
379 | |||
380 | # bitbake python -c create_manifest | ||
381 | # Make sure we have native python ready when we create a new manifest | ||
382 | addtask do_create_manifest after do_patch do_prepare_recipe_sysroot | ||
383 | |||
384 | # manual dependency additions | ||
385 | RRECOMMENDS:${PN}-core:append:class-nativesdk = " nativesdk-python3-modules" | ||
386 | RRECOMMENDS:${PN}-crypt:append:class-target = " ${MLPREFIX}openssl ${MLPREFIX}ca-certificates" | ||
387 | RRECOMMENDS:${PN}-crypt:append:class-nativesdk = " ${MLPREFIX}openssl ${MLPREFIX}ca-certificates" | ||
388 | |||
389 | # For historical reasons PN is empty and provided by python3-modules | ||
390 | FILES:${PN} = "" | ||
391 | RPROVIDES:${PN}-modules = "${PN}" | ||
392 | |||
393 | FILES:${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3" | ||
394 | FILES:${PN}-idle += "${bindir}/idle3 ${bindir}/idle${PYTHON_MAJMIN}" | ||
395 | |||
396 | # provide python-pyvenv from python3-venv | ||
397 | RPROVIDES:${PN}-venv += "${MLPREFIX}python3-pyvenv" | ||
398 | |||
399 | # package libpython3 | ||
400 | PACKAGES =+ "libpython3 libpython3-staticdev" | ||
401 | FILES:libpython3 = "${libdir}/libpython*.so.*" | ||
402 | FILES:libpython3-staticdev += "${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}-*/libpython${PYTHON_MAJMIN}.a" | ||
403 | INSANE_SKIP:${PN}-dev += "dev-elf" | ||
404 | INSANE_SKIP:${PN}-ptest = "dev-deps" | ||
405 | |||
406 | # catch all the rest (unsorted) | ||
407 | PACKAGES += "${PN}-misc" | ||
408 | RDEPENDS:${PN}-misc += "\ | ||
409 | ${PN}-core \ | ||
410 | ${PN}-email \ | ||
411 | ${PN}-codecs \ | ||
412 | ${PN}-pydoc \ | ||
413 | ${PN}-pickle \ | ||
414 | ${PN}-audio \ | ||
415 | ${PN}-numbers \ | ||
416 | " | ||
417 | RDEPENDS:${PN}-modules:append:class-target = " ${MLPREFIX}python3-misc" | ||
418 | RDEPENDS:${PN}-modules:append:class-nativesdk = " ${MLPREFIX}python3-misc" | ||
419 | RDEPENDS:${PN}-modules:append:class-target = " ${@bb.utils.contains('PACKAGECONFIG', 'gdbm', '${MLPREFIX}python3-gdbm', '', d)}" | ||
420 | FILES:${PN}-misc = "${libdir}/python${PYTHON_MAJMIN} ${libdir}/python${PYTHON_MAJMIN}/lib-dynload" | ||
421 | |||
422 | # catch manpage | ||
423 | PACKAGES += "${PN}-man" | ||
424 | FILES:${PN}-man = "${datadir}/man" | ||
425 | |||
426 | # See https://bugs.python.org/issue18748 and https://bugs.python.org/issue37395 | ||
427 | RDEPENDS:libpython3:append:libc-glibc = " libgcc" | ||
428 | RDEPENDS:${PN}-ctypes:append:libc-glibc = " ${MLPREFIX}ldconfig" | ||
429 | RDEPENDS:${PN}-ptest = "${PN}-modules ${PN}-tests ${PN}-dev unzip bzip2 libgcc tzdata coreutils sed" | ||
430 | RDEPENDS:${PN}-ptest:append:libc-glibc = " locale-base-fr-fr locale-base-en-us locale-base-tr-tr locale-base-de-de" | ||
431 | RDEPENDS:${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${MLPREFIX}tk ${MLPREFIX}tk-lib', '', d)}" | ||
432 | RDEPENDS:${PN}-idle += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${PN}-tkinter ${MLPREFIX}tcl', '', d)}" | ||
433 | DEV_PKG_DEPENDENCY = "" | ||
434 | RDEPENDS:${PN}-pydoc += "${PN}-io" | ||
435 | |||
436 | RDEPENDS:${PN}-tests:append:class-target = " ${MLPREFIX}bash" | ||
437 | RDEPENDS:${PN}-tests:append:class-nativesdk = " ${MLPREFIX}bash" | ||
438 | |||
439 | # Python's tests contain large numbers of files we don't need in the recipe sysroots | ||
440 | SYSROOT_PREPROCESS_FUNCS += " py3_sysroot_cleanup" | ||
441 | py3_sysroot_cleanup () { | ||
442 | rm -rf ${SYSROOT_DESTDIR}${libdir}/python${PYTHON_MAJMIN}/test | ||
443 | } | ||