diff --git a/flake.nix b/flake.nix index bcf7099..eb55303 100644 --- a/flake.nix +++ b/flake.nix @@ -299,6 +299,14 @@ condition = version: versionInBetween version "3.15" "3.14.5"; override = filterOutPatch "hacl-static-ldeps-for-static-modules.patch"; } + { + # CPython 3.11.18+/3.12.16+/3.13.18+/3.14.9+/3.15.x wrap the + # `knownfiles` list in an `if sys.platform == "win32"` branch, so + # nixpkgs' mimetypes.patch (flat-list layout) fails to apply. + # Use a replacement patch matching the wrapped layout. + condition = version: versionInBetween version "3.16" "3.11.18"; + override = replacePatch "mimetypes.patch" ./patches/mimetypes-wrapped.patch; + } ]; callPackage = pkgs.newScope { inherit python; diff --git a/patches/mimetypes-wrapped.patch b/patches/mimetypes-wrapped.patch new file mode 100644 index 0000000..2802974 --- /dev/null +++ b/patches/mimetypes-wrapped.patch @@ -0,0 +1,19 @@ +diff --git i/Lib/mimetypes.py w/Lib/mimetypes.py +index f3343c8..ab5b886 100644 +--- i/Lib/mimetypes.py ++++ w/Lib/mimetypes.py +@@ -51,12 +51,4 @@ + else: + knownfiles = [ +- "/etc/mime.types", +- "/etc/httpd/mime.types", # Mac OS X +- "/etc/httpd/conf/mime.types", # Apache +- "/etc/apache/mime.types", # Apache 1 +- "/etc/apache2/mime.types", # Apache 2 +- "/usr/local/etc/httpd/conf/mime.types", +- "/usr/local/lib/netscape/mime.types", +- "/usr/local/etc/httpd/conf/mime.types", # Apache 1.2 +- "/usr/local/etc/mime.types", # Apache 1.3 +- ] ++ "@mime-types@", ++ ]