1{ lib
2, buildPythonPackage
3, pythonOlder
4, fetchPypi
5, hypothesis
6, pytestcache
7, pytestcov
8, pytestflakes
9, pytestpep8
10, pytest
11, glibcLocales
12, mock ? null
13, pathlib ? null
14}:
15
16buildPythonPackage rec {
17 name = "${pname}-${version}";
18 pname = "natsort";
19 version = "5.1.0";
20
21 buildInputs = [
22 hypothesis
23 pytestcache
24 pytestcov
25 pytestflakes
26 pytestpep8
27 pytest
28 glibcLocales
29 ]
30 # pathlib was made part of standard library in 3.5:
31 ++ (lib.optionals (pythonOlder "3.4") [ pathlib ])
32 # based on testing-requirements.txt:
33 ++ (lib.optionals (pythonOlder "3.3") [ mock ]);
34
35 src = fetchPypi {
36 inherit pname version;
37 sha256 = "5db0fd17c9f8ef3d54962a6e46159ce4807c630f0931169cd15ce54f2ac395b9";
38 };
39
40 # do not run checks on nix_run_setup.py
41 patches = [ ./setup.patch ];
42
43 # testing based on project's tox.ini
44 checkPhase = ''
45 pytest --doctest-modules natsort
46 pytest --flakes --pep8 --cov natsort --cov-report term-missing
47 '';
48
49 meta = {
50 description = "Natural sorting for python";
51 homepage = https://github.com/SethMMorton/natsort;
52 license = lib.licenses.mit;
53 };
54}