2019-10-29 01:13:54 +01:00
|
|
|
{ lib, buildPythonPackage, fetchPypi, setuptools, isPy27, futures
|
|
|
|
, backports_functools_lru_cache, mock, pytest
|
|
|
|
}:
|
2018-03-07 15:19:37 +01:00
|
|
|
|
2019-03-05 14:55:42 +01:00
|
|
|
let
|
2019-06-15 09:09:25 +02:00
|
|
|
skipTests = [ "test_requirements_finder" "test_pipfile_finder" ] ++ lib.optional isPy27 "test_standard_library_deprecates_user_issue_778";
|
2019-03-05 14:55:42 +01:00
|
|
|
testOpts = lib.concatMapStringsSep " " (t: "--deselect test_isort.py::${t}") skipTests;
|
|
|
|
in buildPythonPackage rec {
|
2018-03-07 15:19:37 +01:00
|
|
|
pname = "isort";
|
2019-10-16 11:43:08 +02:00
|
|
|
version = "4.3.21"; # Note 4.x is the last version that supports Python2
|
2018-03-07 15:19:37 +01:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2019-10-16 11:43:08 +02:00
|
|
|
sha256 = "54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1";
|
2018-03-07 15:19:37 +01:00
|
|
|
};
|
|
|
|
|
2019-10-29 01:13:54 +01:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
] ++ lib.optionals isPy27 [ futures backports_functools_lru_cache ];
|
2018-03-07 15:19:37 +01:00
|
|
|
|
|
|
|
checkInputs = [ mock pytest ];
|
|
|
|
|
|
|
|
checkPhase = ''
|
2019-10-29 01:13:54 +01:00
|
|
|
# isort excludes paths that contain /build/, so test fixtures don't work
|
|
|
|
# with TMPDIR=/build/
|
2019-03-05 14:55:42 +01:00
|
|
|
PATH=$out/bin:$PATH TMPDIR=/tmp/ pytest ${testOpts}
|
2019-10-29 01:13:54 +01:00
|
|
|
|
|
|
|
# Confirm that the produced executable script is wrapped correctly and runs
|
|
|
|
# OK, by launching it in a subshell without PYTHONPATH
|
|
|
|
(
|
|
|
|
unset PYTHONPATH
|
|
|
|
echo "Testing that `isort --version-number` returns OK..."
|
|
|
|
$out/bin/isort --version-number
|
|
|
|
)
|
2018-03-07 15:19:37 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A Python utility / library to sort Python imports";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/timothycrosley/isort";
|
2018-03-07 15:19:37 +01:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ couchemar nand0p ];
|
|
|
|
};
|
|
|
|
}
|