Skip to contentSkip to conversation

python3: remove obsolete reformatting of _sysconfigdata*.py

PATCH Superseded Ross Burton 2 participants 7 messages Nov 11 – Nov 12

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/6 python3: remove obsolete reformatting of _sysconfigdata*.py

The python3 recipe currently reformats the _sysconfigdata*.py files after they are modified to remove build paths, as the files may be wrapped differently based on the length of strings[1].

However, this wrapping was due to the use of pprint.pprint(), which since Python 3.13 is no longer used to generate the sysconfigdata[2].

As such, remove the reformatting as it is no longer needed.

[1] oe-core ec8a2b310d5 ("python3: Reformat sysconfig")
[2] python 5ecedbd2669 ("gh-106789: avoid importing pprint from sysconfig (#106790)")

---
 .../python/python3/reformat_sysconfig.py      | 21 -------------------
 .../python/python3_3.14.10.bb                 |  8 +------
 2 files changed, 1 insertion(+), 28 deletions(-)
 delete mode 100644 meta/recipes-devtools/python/python3/reformat_sysconfig.py
meta/recipes-devtools/python/python3/reformat_sysconfig.py deleted +0 -21
deleted file mode 100644
index 5e2b12879d9..00000000000
@@ -1,21 +0,0 @@
-#! /usr/bin/env python3
-#
-# SPDX-License-Identifier: MIT
-#
-# Copyright 2019 by Garmin Ltd. or its subsidiaries
-#
-# A script to reformat python sysconfig
-
-import sys
-import pprint
-l = {}
-g = {}
-with open(sys.argv[1], 'r') as f:
-    exec(f.read(), g, l)
-
-with open(sys.argv[1], 'w') as f:
-    for k in sorted(l.keys()):
-        f.write('%s = ' % k)
-        pprint.pprint(l[k], stream=f, width=1)
-        f.write('\n')
-
meta/recipes-devtools/python/python3_3.14.10.bb +1 -7
index c50c4d4babc..28e67330d1a 100644
@@ -12,7 +12,6 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
            file://get_module_deps3.py \
            file://python3-manifest.json \
            file://check_build_completeness.py \
-           file://reformat_sysconfig.py \
            file://0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch \
            file://0001-test_locale.py-correct-the-test-output-format.patch \
            file://makerace.patch \
@@ -214,9 +213,6 @@ do_install:append:class-native() {
 }
 
 do_install:append() {
-        for c in ${D}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do
-            python3 ${UNPACKDIR}/reformat_sysconfig.py $c
-        done
         rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/__pycache__/_sysconfigdata*.cpython*
 
         mkdir -p ${D}${libdir}/python-sysconfigdata
@@ -389,10 +385,8 @@ py_package_preprocess () {
                 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfig_vars*.json \
                 ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config
 
-        # Reformat and recompile _sysconfigdata after modifying it so that it remains
-        # reproducible
+        # Recompile _sysconfigdata after modifying it
         for c in ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do
-            python3 ${UNPACKDIR}/reformat_sysconfig.py $c
             python3 -mcompileall $c -s ${PKGD} -p /
         done
 
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 2/6 python3: compile .pyc at packaging time, remove from manifest

Currently, the manifest lists both .py files and compiled .pyc files. This results in a large amount of duplication and potential for files to end up in the wrong package.

Improve this by not installing the .pyc files directly, and instead using python's compileall module (as upstream's 'make install' does) to build them at packaging time. We can do this after the packages have been split, so the .pyc files are always in the right package.

This means we can remove the cache file logic from create_manifest, and all of the cached file lists in the manifest itself.

We patch out the standard library compilation at install time to avoid doing that twice, this is important as the compilation takes ~30s on my build machine. There is work upstream to make this optional, so we don't need to carry a patch in the future.

The only change to the end result is that the target sysroot for Python is now missing the .pyc files.

---
 .../python/python3/create_manifest3.py        |  55 +---
 .../python/python3/get_module_deps3.py        |  29 --
 .../python/python3/no-compile-pyc.patch       |  26 ++
 .../python/python3/python3-manifest.json      | 301 ++----------------
 .../python/python3_3.14.10.bb                 |  63 ++--
 5 files changed, 87 insertions(+), 387 deletions(-)
 create mode 100644 meta/recipes-devtools/python/python3/no-compile-pyc.patch
meta/recipes-devtools/python/python3/create_manifest3.py +11 -44
index 288d5ede3a2..5dda382de8f 100644
@@ -30,12 +30,6 @@
 # Its also important to note that this method only works for python files, and shared
 # libraries. Static libraries, header files and binaries need to be dealt with manually.
 #
-# This script differs from its python2 version mostly on how shared libraries are handled
-# The manifest file for python3 has an extra field which contains the cached files for
-# each package.
-# Tha method to handle cached files does not work when a module includes a folder which
-# itself contains the pycache folder, gladly this is almost never the case.
-#
 # Author: Alejandro Enedino Hernandez Samaniego <alejandro at enedino dot org>
 
 
@@ -77,12 +71,6 @@ def isFolder(value):
     else:
         return False
 
-def isCached(item):
-    if '__pycache__' in item:
-        return True
-    else:
-        return False
-
 def prepend_comments(comments, json_manifest):
     with open(json_manifest, 'r+') as manifest:
         json_contents = manifest.read()
@@ -123,12 +111,8 @@ print_indent('Getting dependencies for package: core', 0)
 output = subprocess.check_output([sys.executable, 'get_module_deps3.py', 'python-core-package', '%s' % debugFlag]).decode('utf8')
 for coredep in output.split():
     coredep = coredep.replace(pyversion,'${PYTHON_MAJMIN}')
-    if isCached(coredep):
-        if coredep not in old_manifest['core']['cached']:
-            old_manifest['core']['cached'].append(coredep)
-    else:
-        if coredep not in old_manifest['core']['files']:
-            old_manifest['core']['files'].append(coredep)
+    if coredep not in old_manifest['core']['files']:
+        old_manifest['core']['files'].append(coredep)
 
 
 # The second step is to loop through the existing files contained in the core package
@@ -139,12 +123,8 @@ for coredep in output.split():
 
 for filedep in old_manifest['core']['files']:
     if isFolder(filedep):
-        if isCached(filedep):
-            if filedep not in old_manifest['core']['cached']:
-                old_manifest['core']['cached'].append(filedep)
-        else:
-            if filedep not in old_manifest['core']['files']:
-                old_manifest['core']['files'].append(filedep)
+        if filedep not in old_manifest['core']['files']:
+            old_manifest['core']['files'].append(filedep)
         continue
     if '${bindir}' in filedep:
         if filedep not in old_manifest['core']['files']:
@@ -175,12 +155,8 @@ for filedep in old_manifest['core']['files']:
     for pymodule_dep in output.split():
         pymodule_dep = pymodule_dep.replace(pyversion,'${PYTHON_MAJMIN}')
 
-        if isCached(pymodule_dep):
-            if pymodule_dep not in old_manifest['core']['cached']:
-                old_manifest['core']['cached'].append(pymodule_dep)
-        else:
-            if pymodule_dep not in old_manifest['core']['files']:
-                old_manifest['core']['files'].append(pymodule_dep)
+        if pymodule_dep not in old_manifest['core']['files']:
+            old_manifest['core']['files'].append(pymodule_dep)
 
 
 # At this point we are done with the core package.
@@ -223,12 +199,10 @@ for pypkg in old_manifest:
     new_manifest[pypkg]['summary'] = old_manifest[pypkg]['summary']
     new_manifest[pypkg]['rdepends'] = []
     new_manifest[pypkg]['files'] = []
-    new_manifest[pypkg]['cached'] = old_manifest[pypkg]['cached']
 
     # All packages should depend on core
     if pypkg != 'core':
         new_manifest[pypkg]['rdepends'].append('core')
-        new_manifest[pypkg]['cached'] = []
 
     print('\n')
     print('--------------------------')
@@ -334,7 +308,7 @@ for pypkg in old_manifest:
                     for pypkg_with_folder in hasfolders:
                         if (folderFound == False):
                             # print('Checking folder %s on package %s' % (pymodule_dep,pypkg_with_folder))
-                            for folder_dep in old_manifest[pypkg_with_folder]['files'] or folder_dep in old_manifest[pypkg_with_folder]['cached']:
+                            for folder_dep in old_manifest[pypkg_with_folder]['files']:
                                 if folder_dep == folder:
                                     print ('%s directory found in %s' % (folder, pypkg_with_folder))
                                     folderFound = True
@@ -351,16 +325,13 @@ for pypkg in old_manifest:
 
             # No directories beyond this point
             # We might already have this module on the dictionary since it could depend on a (previously checked) module
-            if pymodule_dep not in new_manifest[pypkg]['files'] and pymodule_dep not in new_manifest[pypkg]['cached']:
+            if pymodule_dep not in new_manifest[pypkg]['files']:
                 # Handle core as a special package, we already did it so we pass it to NEW data structure directly
                 if pypkg == 'core':
                     print('Adding %s to %s FILES' % (pymodule_dep, pypkg))
                     if pymodule_dep.endswith('*'):
                         wildcards.append(pymodule_dep)
-                    if isCached(pymodule_dep):
-                        new_manifest[pypkg]['cached'].append(pymodule_dep)
-                    else:
-                        new_manifest[pypkg]['files'].append(pymodule_dep)
+                    new_manifest[pypkg]['files'].append(pymodule_dep)
 
                     # Check for repeated files
                     if pymodule_dep not in allfiles:
@@ -378,7 +349,7 @@ for pypkg in old_manifest:
                     for possible_rdep in old_manifest:
                         # Debug
                         # print('Checking %s ' % pymodule_dep + ' in %s' % possible_rdep)
-                        if pymodule_dep in old_manifest[possible_rdep]['files'] or pymodule_dep in old_manifest[possible_rdep]['cached']:
+                        if pymodule_dep in old_manifest[possible_rdep]['files']:
                             # Since were nesting, we need to check its not the same pypkg
                             if(possible_rdep != pypkg):
                                 if possible_rdep not in new_manifest[pypkg]['rdepends']:
@@ -393,10 +364,7 @@ for pypkg in old_manifest:
                       # A module shouldn't contain itself (${libdir}/python3/sqlite3 shouldnt be on sqlite3 files)
                       if os.path.basename(pymodule_dep) != pypkg:
                         reportFILES.append(('Adding %s to %s FILES\n' % (pymodule_dep, pypkg)))
-                        if isCached(pymodule_dep):
-                            new_manifest[pypkg]['cached'].append(pymodule_dep)
-                        else:
-                            new_manifest[pypkg]['files'].append(pymodule_dep)
+                        new_manifest[pypkg]['files'].append(pymodule_dep)
                         if pymodule_dep.endswith('*'):
                             wildcards.append(pymodule_dep)
                         if pymodule_dep not in allfiles:
@@ -423,7 +391,6 @@ print(hasfolders)
 # Sort it just so it looks nicer
 for pypkg in new_manifest:
     new_manifest[pypkg]['files'].sort()
-    new_manifest[pypkg]['cached'].sort()
     new_manifest[pypkg]['rdepends'].sort()
 
 # Create the manifest from the data structure that was built
meta/recipes-devtools/python/python3/get_module_deps3.py +0 -29
index 8e432b49af8..9b4251af485 100644
@@ -141,34 +141,5 @@ for item in dif:
     print (dep_path)
 
 
-    cpython_tag = sys.implementation.cache_tag
-    cached = ''
-    # Theres no naive way to find *.pyc files on python3
-    try:
-        if debug == True:
-            log.write('\nCalling: sys.modules[' + '%s' % item + '].__cached__\n')
-        cached = sys.modules['%s' % item].__cached__
-    except AttributeError as e:
-        # Deals with thread (builtin module) not having __cached__ attribute
-        if debug == True:
-            log.write(item + ' ')
-            log.write(str(e))
-            log.write('\n')
-        pass
-    except NameError as e:
-        # Deals with NameError: name 'cached' is not defined
-        if debug == True:
-            log.write(item+' ') 
-            log.write(str(e))                                              
-        pass
-    if cached is not None:
-        if debug == True:
-            log.write(cached + '\n')
-        cached = fix_path(cached)
-        cached = cached.replace(cpython_tag,'*')
-        if "_sysconfigdata" in cached:
-            cached = cached.replace(sysconfig._get_sysconfigdata_name(), "_sysconfigdata*")
-        print (cached)
-
 if debug == True:
     log.close()
meta/recipes-devtools/python/python3/no-compile-pyc.patch new file +26 -0
new file mode 100644
index 00000000000..e95458f8a51
@@ -0,0 +1,26 @@
+Don't compile the standard library to .pyc files, we'll do that at packaging instead.
+
+Upstream-Status: Inappropriate [https://github.com/python/cpython/issues/160835]
+Signed-off-by: Ross Burton <[email protected]>
+
+diff --git i/Makefile.pre.in w/Makefile.pre.in
+index 3d12153cb6c..b32eef4810a 100644
+--- i/Makefile.pre.in
++++ w/Makefile.pre.in
+@@ -2829,16 +2829,6 @@ libinstall:	all $(srcdir)/Modules/xxmodule.c
+ 		echo "Applying app store compliance patch"; \
+ 		patch --force --reject-file "$(abs_builddir)/app-store-compliance.rej" --strip 2 --directory "$(DESTDIR)$(LIBDEST)" --input "$(abs_srcdir)/$(APP_STORE_COMPLIANCE_PATCH)" || true ; \
+ 	fi
+-	@ # Build PYC files for the 3 optimization levels (0, 1, 2)
+-	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+-		$(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+-		-o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST) -f \
+-		-x 'bad_coding|badsyntax|site-packages' \
+-		$(DESTDIR)$(LIBDEST)
+-	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+-		$(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+-		-o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST)/site-packages -f \
+-		-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+ 
+ # bpo-21536: Misc/python-config.sh is generated in the build directory
+ # from $(srcdir)Misc/python-config.sh.in.
meta/recipes-devtools/python/python3/python3-manifest.json +27 -274

641 lines not on this page · raw message

meta/recipes-devtools/python/python3_3.14.10.bb +23 -40

124 lines not on this page · raw message

Signature · 1 line
2.43.0
#2 lore raw

PATCH v2 3/6 python3: don't copy from UNPACKDIR to WORKDIR

In reply to Ross Burton

There's no need to copy files from UNPACKDIR to WORKDIR, we can just do the work in UNPACKDIR.

---
 meta/recipes-devtools/python/python3_3.14.10.bb | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
meta/recipes-devtools/python/python3_3.14.10.bb +1 -4
index c57868bf709..574b8e31d41 100644
@@ -475,11 +475,8 @@ do_create_manifest() {
     # e.g. BerkeleyDB is an optional build dependency so it may or may not
     # be present, we must ensure it is.
 
-    cp ${UNPACKDIR}/create_manifest3.py ${WORKDIR}
-    cp ${UNPACKDIR}/python3-manifest.json ${WORKDIR}
-    cp ${UNPACKDIR}/get_module_deps3.py ${WORKDIR}
-    cd ${WORKDIR}
     # This needs to be executed by python-native and NOT by HOST's python
+    cd ${UNPACKDIR}
     nativepython3 create_manifest3.py ${PYTHON_MAJMIN}
     cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json
 }
Signature · 1 line
2.43.0
#3 lore raw

PATCH v2 4/6 python3: no need to use an OrderedDict

In reply to Ross Burton

As of Python 3.7, standard dictionaries are sorted by insertion order. As this stable order was the only reason for using OrderedDict, we can switch to using a normal dictionary.

---
 meta/recipes-devtools/python/python3/create_manifest3.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
meta/recipes-devtools/python/python3/create_manifest3.py +3 -4
index 5dda382de8f..029d9235c1a 100644
@@ -37,7 +37,6 @@ import sys
 import subprocess
 import json
 import os
-import collections
 
 if '-d' in sys.argv:
     debugFlag = '-d'
@@ -54,7 +53,7 @@ for p in sys.path:
         nativelibfolder = p[:p.find(pivot)+len(pivot)]
 
 # Empty dict to hold the whole manifest
-new_manifest = collections.OrderedDict()
+new_manifest = {}
 
 # Check for repeated files, folders and wildcards
 allfiles = []
@@ -91,7 +90,7 @@ with open('python3-manifest.json') as manifest:
     manifest.seek(0)
     comments = manifest.read(json_start)
     manifest_str = manifest.read()
-    old_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict)
+    old_manifest = json.loads(manifest_str)
 
 #
 # First pass to get core-package functionality, because we base everything on the fact that core is actually working
@@ -195,7 +194,7 @@ for pypkg in old_manifest:
 
 for pypkg in old_manifest:
     # Use an empty dict as data structure to hold data for each package and fill it up
-    new_manifest[pypkg] = collections.OrderedDict()
+    new_manifest[pypkg] = {}
     new_manifest[pypkg]['summary'] = old_manifest[pypkg]['summary']
     new_manifest[pypkg]['rdepends'] = []
     new_manifest[pypkg]['files'] = []
Signature · 1 line
2.43.0
#4 lore raw

PATCH v2 5/6 python3: add support for skipping dependencies when building the manifest

In reply to Ross Burton

The manifest generation works by importing modules and seeing what other modules also get included. This means the manifest is maximal, for example shutil tries to import all of the compression modules to determine what compression types are available.

Add a "skip_depends" element to the manifest so we can mark up specific dependencies that should be ignored when generating the manifest.

---
 .../python/python3/create_manifest3.py           | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
meta/recipes-devtools/python/python3/create_manifest3.py +16 -0
index 029d9235c1a..b713dba5ee9 100644
@@ -81,6 +81,14 @@ def print_indent(msg, offset):
         msg = ' ' * offset + l
         print(msg)
 
+def is_dependency_skipped(manifest, package, dependency):
+    """
+    Check to see if this dependency should be ignored by matching substrings
+    from the optional skip_depends element in the manifest.
+    """
+    skiplist = manifest.get('skip_depends', {}).get(package, [])
+    return any((skip in dependency for skip in skiplist))
+
 
 # Read existing JSON manifest
 with open('python3-manifest.json') as manifest:
@@ -109,6 +117,8 @@ print_indent('Getting dependencies for package: core', 0)
 
 output = subprocess.check_output([sys.executable, 'get_module_deps3.py', 'python-core-package', '%s' % debugFlag]).decode('utf8')
 for coredep in output.split():
+    if is_dependency_skipped(old_manifest['core'], "core", coredep):
+        continue
     coredep = coredep.replace(pyversion,'${PYTHON_MAJMIN}')
     if coredep not in old_manifest['core']['files']:
         old_manifest['core']['files'].append(coredep)
@@ -152,6 +162,8 @@ for filedep in old_manifest['core']['files']:
 
 
     for pymodule_dep in output.split():
+        if is_dependency_skipped(old_manifest['core'], pymodule, pymodule_dep):
+            continue
         pymodule_dep = pymodule_dep.replace(pyversion,'${PYTHON_MAJMIN}')
 
         if pymodule_dep not in old_manifest['core']['files']:
@@ -197,6 +209,8 @@ for pypkg in old_manifest:
     new_manifest[pypkg] = {}
     new_manifest[pypkg]['summary'] = old_manifest[pypkg]['summary']
     new_manifest[pypkg]['rdepends'] = []
+    if "skip_depends" in old_manifest[pypkg]:
+        new_manifest[pypkg]['skip_depends'] = old_manifest[pypkg]['skip_depends']
     new_manifest[pypkg]['files'] = []
 
     # All packages should depend on core
@@ -272,6 +286,8 @@ for pypkg in old_manifest:
         reportRDEPS = []
 
         for pymodule_dep in output.split():
+            if is_dependency_skipped(new_manifest[pypkg], pymodule, pymodule_dep):
+                continue
 
             # Warning: This first part is ugly
             # One of the dependencies that was found, could be inside of one of the folders included by another package
Signature · 1 line
2.43.0
#5 lore raw

PATCH v2 6/6 python3: refresh manifest

In reply to Ross Burton

Add some dependency skips:

- the core imports in zipimport (->compression), but as importing of .zip files is relatively niche skip this dependency.
- shutil imports all of compression to determine what methods are available. Skip this dependency, packages which use shutil.make_archive() can depend on -compression. Notable, ensurepip needs to unpack a wheel.

Consolidate the compression files into -compression instead of being spread across multiple packages.

Put _interpreters.so and _remote_debugging.so into the appropriate packages, remove some previously installed libraries that are now part of the interpreter, and refresh the dependencies.

---
 .../python/python3/python3-manifest.json      | 72 ++++++++++++++-----
 .../python/python3_3.14.10.bb                 |  1 +
 2 files changed, 54 insertions(+), 19 deletions(-)
meta/recipes-devtools/python/python3/python3-manifest.json +53 -19
index 4cfbbf978d1..b2c83ef0e50 100644
@@ -106,6 +106,7 @@
         "summary": "Python Asynchronous I/O",
         "rdepends": [
             "core",
+            "debugger",
             "io",
             "logging",
             "netclient",
@@ -154,16 +155,33 @@
             "core"
         ],
         "files": [
+            "${libdir}/python${PYTHON_MAJMIN}/bz2.py",
+            "${libdir}/python${PYTHON_MAJMIN}/compression",
             "${libdir}/python${PYTHON_MAJMIN}/gzip.py",
+            "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_bz2.*.so",
+            "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_lzma.*.so",
+            "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_zstd.*.so",
+            "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/zlib.*.so",
+            "${libdir}/python${PYTHON_MAJMIN}/lzma.py",
             "${libdir}/python${PYTHON_MAJMIN}/tarfile.py",
-            "${libdir}/python${PYTHON_MAJMIN}/zipfile/",
-            "${libdir}/python${PYTHON_MAJMIN}/compression/",
-            "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_zstd.*.so"
+            "${libdir}/python${PYTHON_MAJMIN}/zipfile"
         ]
     },
     "core": {
         "summary": "Python interpreter and core modules",
-        "rdepends": ["compression"],
+        "rdepends": [],
+        "skip_depends": {
+            "core": [
+                "zipimport"
+            ],
+            "shutil": [
+                "compression",
+                "bz2",
+                "lzma",
+                "zlib",
+                "zstd"
+            ]
+        },
         "files": [
             "${bindir}/python${PYTHON_MAJMIN}",
             "${bindir}/python${PYTHON_MAJMIN}.real",
@@ -178,22 +196,20 @@
             "${libdir}/python${PYTHON_MAJMIN}/_bootlocale.py",
             "${libdir}/python${PYTHON_MAJMIN}/_collections_abc.py",
             "${libdir}/python${PYTHON_MAJMIN}/_colorize.py",
-            "${libdir}/python${PYTHON_MAJMIN}/_compression.py",
             "${libdir}/python${PYTHON_MAJMIN}/_markupbase.py",
             "${libdir}/python${PYTHON_MAJMIN}/_opcode_metadata.py",
             "${libdir}/python${PYTHON_MAJMIN}/_py_warnings.py",
             "${libdir}/python${PYTHON_MAJMIN}/_pyrepl",
             "${libdir}/python${PYTHON_MAJMIN}/_pyrepl/pager.py",
             "${libdir}/python${PYTHON_MAJMIN}/_sitebuiltins.py",
-            "${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py",
             "${libdir}/python${PYTHON_MAJMIN}/_sysconfig_vars*.json",
+            "${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py",
             "${libdir}/python${PYTHON_MAJMIN}/_weakrefset.py",
             "${libdir}/python${PYTHON_MAJMIN}/abc.py",
             "${libdir}/python${PYTHON_MAJMIN}/annotationlib.py",
             "${libdir}/python${PYTHON_MAJMIN}/argparse.py",
             "${libdir}/python${PYTHON_MAJMIN}/ast.py",
             "${libdir}/python${PYTHON_MAJMIN}/bisect.py",
-            "${libdir}/python${PYTHON_MAJMIN}/bz2.py",
             "${libdir}/python${PYTHON_MAJMIN}/code.py",
             "${libdir}/python${PYTHON_MAJMIN}/codecs.py",
             "${libdir}/python${PYTHON_MAJMIN}/codeop.py",
@@ -235,10 +251,9 @@
             "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/__pycache__/time.*.so",
             "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/__pycache__/xreadlines.*.so",
             "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_bisect.*.so",
-            "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_bz2.*.so",
             "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_csv.*.so",
             "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_heapq.*.so",
-            "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_lzma.*.so",
+            "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_interpreters.*.so",
             "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_opcode.*.so",
             "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_posixsubprocess.*.so",
             "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_struct.*.so",
@@ -254,10 +269,8 @@
             "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/time.*.so",
             "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/unicodedata.*.so",
             "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/xreadlines.*.so",
-            "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/zlib.*.so",
             "${libdir}/python${PYTHON_MAJMIN}/linecache.py",
             "${libdir}/python${PYTHON_MAJMIN}/locale.py",
-            "${libdir}/python${PYTHON_MAJMIN}/lzma.py",
             "${libdir}/python${PYTHON_MAJMIN}/new.py",
             "${libdir}/python${PYTHON_MAJMIN}/ntpath.py",
             "${libdir}/python${PYTHON_MAJMIN}/opcode.py",
@@ -268,6 +281,8 @@
             "${libdir}/python${PYTHON_MAJMIN}/pathlib.py",
             "${libdir}/python${PYTHON_MAJMIN}/pathlib/_abc.py",
             "${libdir}/python${PYTHON_MAJMIN}/pathlib/_local.py",
+            "${libdir}/python${PYTHON_MAJMIN}/pathlib/_os.py",
+            "${libdir}/python${PYTHON_MAJMIN}/pathlib/types.py",
             "${libdir}/python${PYTHON_MAJMIN}/pkgutil.py",
             "${libdir}/python${PYTHON_MAJMIN}/platform.py",
             "${libdir}/python${PYTHON_MAJMIN}/posixpath.py",
@@ -327,6 +342,7 @@
     "ctypes": {
         "summary": "Python C types support",
         "rdepends": [
+            "compression",
             "core",
             "io",
             "math"
@@ -356,8 +372,7 @@
         "files": [
             "${libdir}/python${PYTHON_MAJMIN}/_strptime.py",
             "${libdir}/python${PYTHON_MAJMIN}/calendar.py",
-            "${libdir}/python${PYTHON_MAJMIN}/datetime.py",
-            "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_datetime.*.so"
+            "${libdir}/python${PYTHON_MAJMIN}/datetime.py"
         ]
     },
     "db": {
@@ -373,13 +388,22 @@
     "debugger": {
         "summary": "Python debugger",
         "rdepends": [
+            "asyncio",
+            "compression",
             "core",
+            "io",
+            "json",
+            "logging",
+            "math",
+            "netclient",
+            "numbers",
             "pprint",
             "shell",
             "stringold"
         ],
         "files": [
             "${libdir}/python${PYTHON_MAJMIN}/bdb.py",
+            "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_remote_debugging.*.so",
             "${libdir}/python${PYTHON_MAJMIN}/pdb.py"
         ]
     },
@@ -414,9 +438,17 @@
     "doctest": {
         "summary": "Python framework for running examples in docstrings",
         "rdepends": [
+            "asyncio",
+            "compression",
             "core",
             "debugger",
             "difflib",
+            "io",
+            "json",
+            "logging",
+            "math",
+            "netclient",
+            "numbers",
             "pprint",
             "shell",
             "stringold",
@@ -456,9 +488,7 @@
         "rdepends": [
             "core"
         ],
-        "files": [
-            "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/fcntl.*.so"
-        ]
+        "files": []
     },
     "gdbm": {
         "summary": "Python GNU database support",
@@ -500,6 +530,7 @@
     "io": {
         "summary": "Python low-level I/O",
         "rdepends": [
+            "compression",
             "core",
             "math",
             "netclient"
@@ -645,10 +676,12 @@
     "multiprocessing": {
         "summary": "Python multiprocessing support",
         "rdepends": [
+            "compression",
             "core",
             "crypt",
             "ctypes",
             "io",
+            "json",
             "math",
             "mmap",
             "netclient",
@@ -679,6 +712,7 @@
             "${libdir}/python${PYTHON_MAJMIN}/hmac.py",
             "${libdir}/python${PYTHON_MAJMIN}/http",
             "${libdir}/python${PYTHON_MAJMIN}/http/__pycache__",
+            "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_hmac.*.so",
             "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_uuid.*.so",
             "${libdir}/python${PYTHON_MAJMIN}/mimetypes.py",
             "${libdir}/python${PYTHON_MAJMIN}/poplib.py",
@@ -708,7 +742,6 @@
             "${libdir}/python${PYTHON_MAJMIN}/contextvars.py",
             "${libdir}/python${PYTHON_MAJMIN}/decimal.py",
             "${libdir}/python${PYTHON_MAJMIN}/fractions.py",
-            "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_contextvars.*.so",
             "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_decimal.*.so",
             "${libdir}/python${PYTHON_MAJMIN}/numbers.py"
         ]
@@ -788,8 +821,7 @@
     "shell": {
         "summary": "Python shell-like functionality",
         "rdepends": [
-            "core",
-            "stringold"
+            "core"
         ],
         "files": [
             "${libdir}/python${PYTHON_MAJMIN}/cmd.py",
@@ -910,8 +942,10 @@
     "venv": {
         "summary": "Provides support for creating lightweight virtual environments with their own site directories, optionally isolated from system site directories.",
         "rdepends": [
+            "compression",
             "core",
             "logging",
+            "shell",
             "stringold"
         ],
         "files": [
meta/recipes-devtools/python/python3_3.14.10.bb +1 -0
index 574b8e31d41..d7ddd5f404e 100644
@@ -555,6 +555,7 @@ RDEPENDS:${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${MLPREF
 RDEPENDS:${PN}-idle += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${PN}-tkinter ${MLPREFIX}tcl', '', d)}"
 DEV_PKG_DEPENDENCY = ""
 RDEPENDS:${PN}-pydoc += "${PN}-io"
+RDEPENDS:${PN}-ensurepip += "${PN}-compression"
 
 RDEPENDS:${PN}-tests:append:class-target = " ${MLPREFIX}bash"
 RDEPENDS:${PN}-tests:append:class-nativesdk = " ${MLPREFIX}bash"
Signature · 1 line
2.43.0
#6 lore raw
In reply to Ross Burton
Quoted 7 lines · Ross Burton via openembedded-core

The python3 recipe currently reformats the _sysconfigdata*.py files after they are modified to remove build paths, as the files may be wrapped differently based on the length of strings[1].

However, this wrapping was due to the use of pprint.pprint(), which since Python 3.13 is no longer used to generate the sysconfigdata[2].

Quoted 7 lines

As such, remove the reformatting as it is no longer needed.

[1] oe-core ec8a2b310d5 ("python3: Reformat sysconfig")
[2] python 5ecedbd2669 ("gh-106789: avoid importing pprint from sysconfig (#106790)")

---

Hi Ross,

I'm sorry, but I can see a lot of red:

ERROR: nativesdk-python3-3.14.10-r0 do_package_write_rpm: Execution of '/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-python3/3.14.10/temp/run.BUILDSPEC.3120668' failed with exit code 1
...
Processing files: nativesdk-python3-tests-3.14.10-r0.x86_64_nativesdk
| error: Directory not found: /srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-python3/3.14.10/package/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/python3.14/test/__pycache__ | error: Directory not found: /srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-python3/3.14.10/package/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/python3.14/test/test_free_threading/__pycache__
...

https://autobuilder.yoctoproject.org/valkyrie/#/builders/4/builds/5022

I can see this on virtually all builds.

I know we had a lot of changes on python3 in the last days, so maybe this is just conflicting with other changes.

I also note this was tested on yesterday master branch. I know it conflicts with your other patches merged this morning, so it won't apply cleanly on master.

Thanks,
Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com