From c358e1ded90fb05fc628e397f71848fe1467aec6 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 11 Jun 2018 16:45:25 +0200 Subject: [PATCH] python3Packages.click: fix 'locale' path importing click shells out to 'locale', which currently needs to be in PATH. Fix by setting patching locale command at runtime. --- pkgs/development/python-modules/click/default.nix | 8 +++++++- pkgs/development/python-modules/click/fix-paths.patch | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/python-modules/click/fix-paths.patch diff --git a/pkgs/development/python-modules/click/default.nix b/pkgs/development/python-modules/click/default.nix index d5dfba61010c..295c6d51955d 100644 --- a/pkgs/development/python-modules/click/default.nix +++ b/pkgs/development/python-modules/click/default.nix @@ -1,4 +1,4 @@ -{ stdenv, buildPythonPackage, fetchPypi, pytest }: +{ stdenv, buildPythonPackage, fetchPypi, substituteAll, glibc, pytest }: buildPythonPackage rec { pname = "click"; @@ -9,6 +9,12 @@ buildPythonPackage rec { sha256 = "02qkfpykbq35id8glfgwc38yc430427yd05z1wc5cnld8zgicmgi"; }; + patches = stdenv.lib.optionals (stdenv.isLinux && !stdenv.hostPlatform.isMusl) + (substituteAll { + src = ./fix-paths.patch; + locale = "${glibc.bin}/bin/locale"; + }); + buildInputs = [ pytest ]; checkPhase = '' diff --git a/pkgs/development/python-modules/click/fix-paths.patch b/pkgs/development/python-modules/click/fix-paths.patch new file mode 100644 index 000000000000..04719871b76c --- /dev/null +++ b/pkgs/development/python-modules/click/fix-paths.patch @@ -0,0 +1,11 @@ +--- a/click/_unicodefun.py 2018-06-11 15:08:59.369358278 +0200 ++++ b/click/_unicodefun.py 2018-06-11 15:09:09.342325998 +0200 +@@ -60,7 +60,7 @@ + extra = '' + if os.name == 'posix': + import subprocess +- rv = subprocess.Popen(['locale', '-a'], stdout=subprocess.PIPE, ++ rv = subprocess.Popen(['@locale@', '-a'], stdout=subprocess.PIPE, + stderr=subprocess.PIPE).communicate()[0] + good_locales = set() + has_c_utf8 = False