pyports.nix
Python package ports using the same DSL as ports2.nix
Returns a packageOverrides function for Python
This will be converted to a packageOverrides function
The pin matches the Fil-C GLib and gobject-introspection. The build Python's PyGObject links the ordinary native GLib and GI, which 3.48.2's tests do not build against, so it stays the Nixpkgs one.
| src | "3.48.2" "sha256-B5SutKm+MaCSrCBiG19U7CgPkYWUPTKLEFza5imK0ac=" v: "https://download.gnome.org/sources/pygobject/3.48/pygobject-${v}.tar.xz" | |
| patch | ./ports/patch/pygobject-3.48.2.patch |
mypyc-generated C loads pointer fields as the integer type CPyPtr and writes through them, which loses the Fil-C capability and traps (e.g. charset-normalizer's compiled modules). These overrides also reach the build platform's mypy, which is the one that runs mypyc for Fil-C packages; the typedef change only applies when compiling with Fil-C. | ||
| patch | ./patches/mypyc-filc-pointer-cpyptr.patch | |
Python.h must come first: glibc 2.44 headers define _POSIX_C_SOURCE differently, and mypyc builds with -Werror. | ||
| patch | ./patches/mypy-function-wrapper-python-h-first.patch | |
| use | ||
| use | λold setup.py unconditionally enables LTO for compilation and linking. Fil-C has no LLVMgold.so; use ordinary objects for this optional optimization rather than rebuilding the compiler or interpreter. old.postPatch or "" + substituteInPlace setup.py \ --replace-fail '"-g0", "-flto"' '"-g0"' cp ${./tests/python-backports-zstd.py} tests/test_filc_boundaries.py |
| use | λold Test the client under Fil-C Python, but run the real HTTP/TLS test server as a native tool. Its Swagger dependency imports Rust rpds, which the Fil-C interpreter cannot load. old.postPatch or "" + test ! -e tests/conftest.py cp ${./tests/httpcore-httpbin.py} tests/conftest.py |
| use | λold The XML deserializer's complexity check times one parse of a one-character field against a 1000-character one and requires the ratio to stay under 2. Both take microseconds, so on a loaded builder the ratio is noise (3.4 in a campaign). The varying-depth check, averaged over four ratios of larger inputs, still runs. |
| patch | ./patches/cffi-filc.patch | |
| use | λold old.disabledTestPaths or [ ] ++ The pure-Python ctypes backend passes every address through ctypes.cast() from an integer, so its pointers have no capability. test_ffi_backend.py::TestFFI runs the same tests on _cffi_backend. "testing/cffi0/test_ctypes.py" "testing/cffi0/test_function.py::TestFunction" "testing/cffi0/test_ownlib.py::TestOwnLib" "testing/cffi0/test_verify.py::test_ctypes_backend_forces_generic_engine" "testing/cffi0/test_verify2.py::test_ctypes_backend_forces_generic_engine" "testing/cffi0/test_vgen.py::test_ctypes_backend_forces_generic_engine" "testing/cffi0/test_vgen2.py::test_ctypes_backend_forces_generic_engine" They cast integers to pointers and dereference them. "src/c/test_c.py::test_cast_between_pointers" "testing/cffi0/test_ffi_backend.py::TestFFI::test_cast_pointer_and_int" "testing/cffi1/test_new_ffi_1.py::TestNewFFI1::test_cast_pointer_and_int" It calls a function pointer that went through intptr_t. "testing/cffi1/test_recompiler.py::test_convert_api_mode_builtin_function_to_cdata" It indexes a from_buffer() pointer out of bounds ("hopefully does not crash"). "src/c/test_c.py::test_from_buffer_types" Fil-C zeroes every allocation, so should_clear_after_alloc=False never yields dirty memory. "testing/cffi1/test_ffi_obj.py::test_ffi_new_allocator_1" They dlopen find_library('dl'). libdl has been part of libc since glibc 2.34 and the sandbox has no ldconfig cache, so -ldl only resolves to the empty libdl.a. "testing/cffi0/test_ffi_backend.py::TestFFI::test_dlopen_handle" "testing/cffi1/test_re_python.py::test_dlopen_handle" Fil-C exports pizlonated_* and pizlonated<N>ET* symbols. "testing/cffi1/test_cffi_binary.py::test_no_unknown_exported_symbols" |
heap_info/heap_trim wrap glibc's mallinfo2/malloc_trim, which see none of Fil-C's GC heap; build them out as on musl. | ||
| patch | ./patches/psutil-filc-no-heap-info.patch | |
| use | ||
| use | λold The upb C extension (google._upb._message) keeps pointers in integer words (arena block allocators, hash entries) and traps at import under Fil-C. api_implementation probes it before it reads PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION, so that variable cannot avoid it. The build-time constant module makes the pure-Python backend the default without the probe (the variable can still select upb). Porting upb itself is a separate job. |
The bundled harfbuzz swaps qsort elements bytewise, which mismatches pointers and capabilities (fonttools' check input). | ||
| patch | ./patches/uharfbuzz-sort-swap-memcpy.patch | |
Its byte stack mixes pointer-bearing records with byte opcodes. Align every entry under Fil-C so copied pointers retain their capabilities. | ||
| patch | ./patches/regex-filc-stack-alignment.patch | |
Skia's arena stores destructor pointers unaligned (fonttools' check input). | ||
| patch | ./patches/skia-pathops-arena-footer-ptrtable.patch | |
Custom package - defined inline since it's not in pyprev