about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorJaakko Luttinen <jaakko.luttinen@iki.fi>2017-05-14 21:05:50 +0300
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2017-05-14 20:05:50 +0200
commit8a68e4c7f6ae76f3a872142e452370fc300bb429 (patch)
tree30172cfd0320dc2a59f9dab0bce613ea9d701687 /pkgs
parent2a6edacc4ee3379135a30d6cd6e7b3399db42af4 (diff)
downloadnixlib-8a68e4c7f6ae76f3a872142e452370fc300bb429.tar
nixlib-8a68e4c7f6ae76f3a872142e452370fc300bb429.tar.gz
nixlib-8a68e4c7f6ae76f3a872142e452370fc300bb429.tar.bz2
nixlib-8a68e4c7f6ae76f3a872142e452370fc300bb429.tar.lz
nixlib-8a68e4c7f6ae76f3a872142e452370fc300bb429.tar.xz
nixlib-8a68e4c7f6ae76f3a872142e452370fc300bb429.tar.zst
nixlib-8a68e4c7f6ae76f3a872142e452370fc300bb429.zip
pythonPackages.natsort: 5.0.1 -> 5.0.3
* pythonPackages.natsort: refactor config

* pythonPackages.natsort: 5.0.1 -> 5.0.3

* pythonPackages.natsort: fix broken
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/python-modules/natsort/default.nix54
-rw-r--r--pkgs/development/python-modules/natsort/setup.patch20
-rw-r--r--pkgs/top-level/python-packages.nix29
3 files changed, 75 insertions, 28 deletions
diff --git a/pkgs/development/python-modules/natsort/default.nix b/pkgs/development/python-modules/natsort/default.nix
new file mode 100644
index 000000000000..79ec9f5bd896
--- /dev/null
+++ b/pkgs/development/python-modules/natsort/default.nix
@@ -0,0 +1,54 @@
+{ lib
+, buildPythonPackage
+, pythonOlder
+, fetchPypi
+, hypothesis
+, pytestcache
+, pytestcov
+, pytestflakes
+, pytestpep8
+, pytest
+, glibcLocales
+, mock ? null
+, pathlib ? null
+}:
+
+buildPythonPackage rec {
+  name = "${pname}-${version}";
+  pname = "natsort";
+  version = "5.0.3";
+
+  buildInputs = [
+    hypothesis
+    pytestcache
+    pytestcov
+    pytestflakes
+    pytestpep8
+    pytest
+    glibcLocales
+  ]
+  # pathlib was made part of standard library in 3.5:
+  ++ (lib.optionals (pythonOlder "3.4") [ pathlib ])
+  # based on testing-requirements.txt:
+  ++ (lib.optionals (pythonOlder "3.3") [ mock ]);
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1h87n0jcsi6mgjx1pws6g1lmcn8jwabwxj8hq334jvziaq0plyym";
+  };
+
+  # do not run checks on nix_run_setup.py
+  patches = [ ./setup.patch ];
+
+  # testing based on project's tox.ini
+  checkPhase = ''
+    pytest --doctest-modules natsort
+    pytest --flakes --pep8 --cov natsort --cov-report term-missing
+  '';
+
+  meta = {
+    description = "Natural sorting for python";
+    homepage = https://github.com/SethMMorton/natsort;
+    license = lib.licenses.mit;
+  };
+}
diff --git a/pkgs/development/python-modules/natsort/setup.patch b/pkgs/development/python-modules/natsort/setup.patch
new file mode 100644
index 000000000000..4c52b740152c
--- /dev/null
+++ b/pkgs/development/python-modules/natsort/setup.patch
@@ -0,0 +1,20 @@
+diff --git a/setup.cfg b/setup.cfg
+index 604994d..e38c3ec 100644
+--- a/setup.cfg
++++ b/setup.cfg
+@@ -6,6 +6,7 @@ formats = gztar
+ 
+ [tool:pytest]
+ flakes-ignore = 
++	nix_run_setup.py ALL
+ 	natsort/compat/py23.py UndefinedName
+ 	natsort/__init__.py UnusedImport
+ 	natsort/compat/* UnusedImport
+@@ -14,6 +15,7 @@ flakes-ignore =
+ 	test_natsort/test_locale_help.py UnusedImport RedefinedWhileUnused
+ 	test_natsort/compat/* UnusedImport
+ pep8ignore = 
++	nix_run_setup.py ALL
+ 	natsort/ns_enum.py E126 E241 E123 E221
+ 	test_natsort/test_*.py E501 E241 E221
+ 	test_natsort/test_natsort_keygen.py E501 E241 E221 E701
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 07bb85632cce..db52731f0b23 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -8193,34 +8193,7 @@ in {
     };
   };
 
-  natsort = buildPythonPackage rec {
-    name = "natsort-5.0.1";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/n/natsort/${name}.tar.gz";
-      sha256 = "4ad6b4d1153451e345967989bd3ca30abf33f615b116eeadfcc51a456e6974a9";
-    };
-
-    buildInputs = with self;
-      [
-        hypothesis
-        pytestcache
-        pytestcov
-        pytestflakes
-        pytestpep8
-        pytest
-        mock
-      ]
-      # pathlib was made part of standard library in 3.5:
-      ++ (optionals (pythonOlder "3.4") [ pathlib ]);
-
-    meta = {
-      description = "Natural sorting for python";
-      homepage = https://github.com/SethMMorton/natsort;
-      license = licenses.mit;
-      broken = true;
-    };
-  };
+  natsort = callPackage ../development/python-modules/natsort { };
 
   logster = buildPythonPackage {
     name = "logster-7475c53822";