commit c7461826ffb360b2a8a2836d83e0b048d51b0e76
parent ea454666bcf1d14152aa4ce8db151632e9977ef0
Author: Nikolay Korotkiy <sikmir@gmail.com>
Date: Fri, 24 Jan 2020 01:52:42 +0300
Add click
Diffstat:
3 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/default.nix b/default.nix
@@ -21,6 +21,7 @@ in rec {
inherit ueberzug;
inherit (sources) cfiles;
};
+ click = python3Packages.callPackage ./pkgs/click { };
csvquote = callPackage ./pkgs/csvquote {
inherit (sources) csvquote;
};
diff --git a/pkgs/click/default.nix b/pkgs/click/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, buildPythonPackage, fetchPypi, substituteAll, locale, pytest }:
+
+buildPythonPackage rec {
+ pname = "click";
+ version = "6.7";
+
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "02qkfpykbq35id8glfgwc38yc430427yd05z1wc5cnld8zgicmgi";
+ };
+
+ patches = stdenv.lib.optional (stdenv.lib.versionAtLeast version "6.7") (substituteAll {
+ src = ./fix-paths.patch;
+ locale = "${locale}/bin/locale";
+ });
+
+ buildInputs = [ pytest ];
+
+ checkPhase = ''
+ py.test tests
+ '';
+
+ # https://github.com/pallets/click/issues/823
+ doCheck = false;
+
+ meta = with stdenv.lib; {
+ homepage = http://click.pocoo.org/;
+ description = "Create beautiful command line interfaces in Python";
+ license = licenses.bsd3;
+ };
+}
diff --git a/pkgs/click/fix-paths.patch b/pkgs/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