Skip to content

Commit 7eaf6df

Browse files
authored
Merge pull request #166 from pinarruiz/fix/mimetypes-patch-old-layout
fix: use module-level mimetypes patch for older releases
2 parents c18c900 + 5e5252d commit 7eaf6df

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

‎flake.nix‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,19 @@
294294
condition = version: versionInBetween version "3.12" "3.11";
295295
override = filterOutPatch "f4b31edf2d9d72878dab1f66a36913b5bcc848ec.patch";
296296
}
297+
{
298+
# Older releases define knownfiles at module level. Nixpkgs' current
299+
# mimetypes.patch targets the non-Windows branch, which only exists
300+
# in these maintenance releases and newer.
301+
condition =
302+
version:
303+
versionInBetween version "3.11.18" "3.0"
304+
|| versionInBetween version "3.12.16" "3.12"
305+
|| versionInBetween version "3.13.18" "3.13"
306+
|| versionInBetween version "3.14.9" "3.14"
307+
|| versionInBetween version "3.15.1" "3.15";
308+
override = replacePatch "mimetypes.patch" ./patches/3.11.17-mimetypes.patch;
309+
}
297310
{
298311
# CPython moved knownfiles into a non-Windows branch in these maintenance releases.
299312
condition =

‎patches/3.11.17-mimetypes.patch‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
2+
--- a/Lib/mimetypes.py
3+
+++ b/Lib/mimetypes.py
4+
@@ -49,11 +49,3 @@
5+
knownfiles = [
6+
- "/etc/mime.types",
7+
- "/etc/httpd/mime.types", # Mac OS X
8+
- "/etc/httpd/conf/mime.types", # Apache
9+
- "/etc/apache/mime.types", # Apache 1
10+
- "/etc/apache2/mime.types", # Apache 2
11+
- "/usr/local/etc/httpd/conf/mime.types",
12+
- "/usr/local/lib/netscape/mime.types",
13+
- "/usr/local/etc/httpd/conf/mime.types", # Apache 1.2
14+
- "/usr/local/etc/mime.types", # Apache 1.3
15+
+ "@mime-types@/etc/mime.types",
16+
]

0 commit comments

Comments
 (0)