diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 51043a884eb..d796e45dc06 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -4,6 +4,7 @@ , libffi , gdbm , lzma +, mime-types , ncurses , openssl , readline @@ -187,6 +188,8 @@ in with passthru; stdenv.mkDerivation { # (since it will do a futile invocation of gcc (!) to find # libuuid, slowing down program startup a lot). (./. + "/${sourceVersion.major}.${sourceVersion.minor}/no-ldconfig.patch") + # Make the mimetypes module refer to the right file + ./mimetypes.patch ] ++ optionals (isPy35 || isPy36) [ # Determinism: Write null timestamps when compiling python files. ./3.5/force_bytecode_determinism.patch @@ -247,6 +250,8 @@ in with passthru; stdenv.mkDerivation { postPatch = '' substituteInPlace Lib/subprocess.py \ --replace "'/bin/sh'" "'${bash}/bin/sh'" + substituteInPlace Lib/mimetypes.py \ + --replace "@mime-types@" "${mime-types}" '' + optionalString (x11Support && (tix != null)) '' substituteInPlace "Lib/tkinter/tix.py" --replace "os.environ.get('TIX_LIBRARY')" "os.environ.get('TIX_LIBRARY') or '${tix}/lib'" ''; diff --git a/pkgs/development/interpreters/python/cpython/mimetypes.patch b/pkgs/development/interpreters/python/cpython/mimetypes.patch new file mode 100644 index 00000000000..4ea700a1f2a --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/mimetypes.patch @@ -0,0 +1,23 @@ +diff --git i/Lib/mimetypes.py w/Lib/mimetypes.py +index f3343c8..ab5b886 100644 +--- i/Lib/mimetypes.py ++++ w/Lib/mimetypes.py +@@ -40,16 +40,8 @@ + ] + + 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@/etc/mime.types", ++] + + inited = False + _db = None