From 5b1abe5dd2f4ababb8e0ccd3bddfb0e821e0a60a Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Sun, 14 Mar 2021 13:00:44 +0100 Subject: [PATCH] python3: mimetypesSupport is optional --- pkgs/development/interpreters/python/cpython/default.nix | 6 +++++- pkgs/development/interpreters/python/default.nix | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index d796e45dc06..a98950eeb3e 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -4,7 +4,7 @@ , libffi , gdbm , lzma -, mime-types +, mime-types ? null, mimetypesSupport ? true , ncurses , openssl , readline @@ -55,6 +55,8 @@ assert x11Support -> tcl != null assert bluezSupport -> bluez != null; +assert mimetypesSupport -> mime-types != null; + assert lib.assertMsg (enableOptimizations -> (!stdenv.cc.isClang)) "Optimizations with clang are not supported. configure: error: llvm-profdata is required for a --enable-optimizations build but could not be found."; @@ -188,6 +190,7 @@ 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") + ] ++ optionals mimetypesSupport [ # Make the mimetypes module refer to the right file ./mimetypes.patch ] ++ optionals (isPy35 || isPy36) [ @@ -250,6 +253,7 @@ in with passthru; stdenv.mkDerivation { postPatch = '' substituteInPlace Lib/subprocess.py \ --replace "'/bin/sh'" "'${bash}/bin/sh'" + '' + optionalString mimetypesSupport '' substituteInPlace Lib/mimetypes.py \ --replace "@mime-types@" "${mime-types}" '' + optionalString (x11Support && (tix != null)) '' diff --git a/pkgs/development/interpreters/python/default.nix b/pkgs/development/interpreters/python/default.nix index 3334e378ed1..56496979dc4 100644 --- a/pkgs/development/interpreters/python/default.nix +++ b/pkgs/development/interpreters/python/default.nix @@ -208,6 +208,7 @@ in { stripBytecode = true; includeSiteCustomize = false; enableOptimizations = false; + mimetypesSupport = false; }).overrideAttrs(old: { pname = "python3-minimal"; meta = old.meta // {