diff --git a/.orchestra/config/components/python.yml b/.orchestra/config/components/python.yml index 41ee1f75..5be29d80 100644 --- a/.orchestra/config/components/python.yml +++ b/.orchestra/config/components/python.yml @@ -6,7 +6,7 @@ #@yaml/text-templated-strings --- #@ def python_component(): -#@ python_version = "3.12.7" +#@ python_version = "3.14.4" #@ source_url = "https://www.python.org/ftp/python/" + python_version + "/Python-" + python_version + ".tar.xz" license: LICENSE builds: @@ -21,6 +21,7 @@ builds: "$BUILD_DIR/Python/initconfig.c" cd "$BUILD_DIR" + patch -p1 < "${ORCHESTRA_DOTDIR}/patches/python-fixes.patch" # orchestra's libc has a buggy getaddrinfo; we expect users to have a newer libc ac_cv_buggy_getaddrinfo=no ./configure \ @@ -29,7 +30,6 @@ builds: --enable-optimizations \ --enable-shared \ --enable-ipv6 \ - --disable-test-modules \ --with-ensurepip=install \ --with-lto \ --with-readline \ @@ -51,13 +51,36 @@ builds: ln -s idle3 "${INSTALLDIR}"/bin/idle ln -s pydoc3 "${INSTALLDIR}"/bin/pydoc + PY_VER=$(echo "(@= python_version @)" | grep -Po '^\d\.\d+') + PYTHON_DIR="${INSTALLDIR}/lib/python${PY_VER}" + # Python installs pip alongside itself, this means that there will be # some modules in `lib/python3.XX/site-packages` present due to this # component. Account for them in the orchestra infrastructure. mkdir -p "${INSTALLDIR}/share/orchestra/python-packages" - find "${INSTALLDIR}/lib/python3.12/site-packages" -maxdepth 1 -type d -printf '%f\n' | \ + find "${PYTHON_DIR}/site-packages" -maxdepth 1 -type d -printf '%f\n' | \ grep -P '^[A-Za-z][\w_]*$' > \ "${INSTALLDIR}/share/orchestra/python-packages/python.txt" + + # Remove the test directories, this contributes ~150MB to the install + # size without any practical benefit for us + rm -r "${PYTHON_DIR}/test" "${PYTHON_DIR}/idlelib/idle_test" + + if [ "$RUN_TESTS" -eq 1 ]; then + LD_LIBRARY_PATH=$(realpath .) \ + ./python -m test -j0 \ + `# A whole bunch of these fail because we disabled USERSITE` \ + -x test_embed \ + -i test.test_cmd_line.CmdLineTest.test_empty_PYTHONPATH_issue16309 \ + `# This fails due to libc being in 'link-only'` \ + -i test.test_ctypes.test_find.FindLibraryLinux.test_find_library_with_ld \ + `# This fails due to outdated glibc` \ + -i test.test_posix.PosixTester.test_makedev \ + `# This hangs indefinitely when running in a container, cause unknown` \ + -i 'test.test_socket.RDSTest.*' \ + `# This sometimes fails when run in a container` \ + -i test.test_struct.StructTest.test_endian_table_init_subinterpreters + fi build_dependencies: - host-c-toolchain dependencies: @@ -70,6 +93,7 @@ builds: - sqlite - libb2 - xz + - zstd - host-libc #@ end diff --git a/.orchestra/config/components/pyyaml.yml b/.orchestra/config/components/pyyaml.yml index 46186202..e14478dd 100644 --- a/.orchestra/config/components/pyyaml.yml +++ b/.orchestra/config/components/pyyaml.yml @@ -8,7 +8,7 @@ dependencies: - libyaml - cython requirements: |- - --global-option=--with-libyaml + --config-settings='--global-option=--with-libyaml' pyyaml==6.0.3 #@ end diff --git a/.orchestra/config/components/revng-python-dependencies.yml b/.orchestra/config/components/revng-python-dependencies.yml index f55ca550..5966ff9a 100644 --- a/.orchestra/config/components/revng-python-dependencies.yml +++ b/.orchestra/config/components/revng-python-dependencies.yml @@ -17,15 +17,14 @@ requirements: |- black>=25.1.0,<26.0 flake8>=7.0.0,<8.0 flake8-breakpoint>=1.1.0,<2.0 - flake8-builtins>=2.1.0,<3.0 + flake8-builtins>=3.1.0,<4.0 flake8-comprehensions>=3.10.1,<4.0 flake8-eradicate>=1.4.0,<2.0 - flake8-return>=1.2.0,<2.0 flake8-simplify>=0.19.3,<1.0 pep8-naming>=0.13.3,<1.0 - isort>=5.11.4,<6.0 + isort>=8.0.0,<9.0 codespell>=2.2.2,<3.0 - mypy==1.17.0 + mypy==1.20.2 # Python types, needed for mypy to work correctly boto3-stubs[s3] @@ -47,7 +46,7 @@ requirements: |- Jinja2 gql[aiohttp]==3.5.2 https://github.com/revng/grandiso-networkx/archive/043ce4b.tar.gz - jsonschema>=4.17.3,<4.18.0 + https://github.com/revng/jsonschema/archive/c17ffb2.tar.gz jsonschema-to-typeddict>=1.4.2,<2.0 networkx>=3.3 pefile diff --git a/.orchestra/patches/python-fixes.patch b/.orchestra/patches/python-fixes.patch new file mode 100644 index 00000000..dbcdb2e6 --- /dev/null +++ b/.orchestra/patches/python-fixes.patch @@ -0,0 +1,33 @@ +--- a/Modules/_remote_debugging_module.c ++++ b/Modules/_remote_debugging_module.c +@@ -872,7 +872,7 @@ _Py_RemoteDebug_GetAsyncioDebugAddress(proc_handle_t* handle) + PyErr_SetString(PyExc_RuntimeError, "Failed to find the AsyncioDebug section in the process."); + _PyErr_ChainExceptions1(exc); + } +-#elif defined(__linux__) ++#elif defined(__linux__) && HAVE_PROCESS_VM_READV + // On Linux, search for asyncio debug in executable or DLL + address = search_linux_map_for_section(handle, "AsyncioDebug", "python"); + if (address == 0) { +--- a/Python/remote_debug.h ++++ b/Python/remote_debug.h +@@ -891,7 +891,7 @@ _Py_RemoteDebug_GetPyRuntimeAddress(proc_handle_t* handle) + handle->pid); + _PyErr_ChainExceptions1(exc); + } +-#elif defined(__linux__) ++#elif defined(__linux__) && HAVE_PROCESS_VM_READV + // On Linux, search for 'python' in executable or DLL + address = search_linux_map_for_section(handle, "PyRuntime", "python"); + if (address == 0) { +--- i/Modules/_hacl/include/krml/internal/target.h ++++ w/Modules/_hacl/include/krml/internal/target.h +@@ -153,7 +153,8 @@ typedef double float64_t; + # elif defined(LEGACY_MACOS) + # define KRML_ALIGNED_MALLOC(X, Y) _mm_malloc(Y, X) + # else +-# define KRML_ALIGNED_MALLOC(X, Y) aligned_alloc(X, Y) ++# include ++# define KRML_ALIGNED_MALLOC(X, Y) memalign(X, Y) + # endif + #endif