3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/python-modules/isort/default.nix
2020-12-01 14:44:13 +01:00

44 lines
1.4 KiB
Nix

{ lib, buildPythonPackage, fetchPypi, setuptools, isPy27, futures
, backports_functools_lru_cache, mock, pytest
}:
let
skipTests = [ "test_requirements_finder" "test_pipfile_finder" ] ++ lib.optional isPy27 "test_standard_library_deprecates_user_issue_778";
testOpts = lib.concatMapStringsSep " " (t: "--deselect test_isort.py::${t}") skipTests;
in buildPythonPackage rec {
pname = "isort";
version = "5.6.4"; # Note 4.x is the last version that supports Python2
src = fetchPypi {
inherit pname version;
sha256 = "dcaeec1b5f0eca77faea2a35ab790b4f3680ff75590bfcb7145986905aab2f58";
};
propagatedBuildInputs = [
setuptools
] ++ lib.optionals isPy27 [ futures backports_functools_lru_cache ];
checkInputs = [ mock pytest ];
checkPhase = ''
# isort excludes paths that contain /build/, so test fixtures don't work
# with TMPDIR=/build/
PATH=$out/bin:$PATH TMPDIR=/tmp/ pytest ${testOpts}
# 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
)
'';
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 ];
};
}