2019-03-05 14:55:42 +01:00
|
|
|
{ lib, buildPythonPackage, fetchPypi, 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
|
|
|
|
skipTests = lib.optional isPy27 "test_standard_library_deprecates_user_issue_778";
|
|
|
|
testOpts = lib.concatMapStringsSep " " (t: "--deselect test_isort.py::${t}") skipTests;
|
|
|
|
in buildPythonPackage rec {
|
2018-03-07 15:19:37 +01:00
|
|
|
pname = "isort";
|
2019-03-05 14:55:42 +01:00
|
|
|
version = "4.3.16"; # Note 4.x is the last version that supports Python2
|
2018-03-07 15:19:37 +01:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2019-03-05 14:55:42 +01:00
|
|
|
sha256 = "1v6lapqhc33rxr9698lqjyb49fis27i42p3ymngrw95py3qf7y08";
|
2018-03-07 15:19:37 +01:00
|
|
|
};
|
|
|
|
|
2019-03-05 14:55:42 +01:00
|
|
|
propagatedBuildInputs = lib.optionals isPy27 [ futures backports_functools_lru_cache ];
|
2018-03-07 15:19:37 +01:00
|
|
|
|
|
|
|
checkInputs = [ mock pytest ];
|
|
|
|
|
2019-03-05 14:55:42 +01:00
|
|
|
# isort excludes paths that contain /build/, so test fixtures don't work with TMPDIR=/build/
|
2018-03-07 15:19:37 +01:00
|
|
|
checkPhase = ''
|
2019-03-05 14:55:42 +01:00
|
|
|
PATH=$out/bin:$PATH TMPDIR=/tmp/ pytest ${testOpts}
|
2018-03-07 15:19:37 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A Python utility / library to sort Python imports";
|
|
|
|
homepage = https://github.com/timothycrosley/isort;
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ couchemar nand0p ];
|
|
|
|
};
|
|
|
|
}
|