diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2020-11-30 18:40:06 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2020-12-01 14:44:25 +0100 |
commit | 7d6468de0c54621f056403e6dae2c97f31700806 (patch) | |
tree | 3881f1d598b2a373e612a5a7fa27a81524bf03e9 | |
parent | aadeda550a2037d2bf00be7fdd8eb641671efbf1 (diff) |
pythonPackages.isort: fix build system, keep version for python 2
-rw-r--r-- | pkgs/development/python-modules/isort/4.nix | 43 | ||||
-rw-r--r-- | pkgs/development/python-modules/isort/default.nix | 9 | ||||
-rw-r--r-- | pkgs/top-level/python-packages.nix | 6 |
3 files changed, 50 insertions, 8 deletions
diff --git a/pkgs/development/python-modules/isort/4.nix b/pkgs/development/python-modules/isort/4.nix new file mode 100644 index 000000000000..b2ef4e66f361 --- /dev/null +++ b/pkgs/development/python-modules/isort/4.nix @@ -0,0 +1,43 @@ +{ 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 = "4.3.21"; # Note 4.x is the last version that supports Python2 + + src = fetchPypi { + inherit pname version; + sha256 = "54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1"; + }; + + 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 ]; + }; +} diff --git a/pkgs/development/python-modules/isort/default.nix b/pkgs/development/python-modules/isort/default.nix index 4c28ad9cf68d..bc11697339e8 100644 --- a/pkgs/development/python-modules/isort/default.nix +++ b/pkgs/development/python-modules/isort/default.nix @@ -1,10 +1,9 @@ { lib, buildPythonPackage, fetchFromGitHub , colorama , hypothesis -, poetry +, poetry-core , pylama , pytestCheckHook -, setuptools }: let @@ -20,10 +19,8 @@ in buildPythonPackage rec { sha256 = "1m7jpqssnbsn1ydrw1dn7nrcrggqcvj9v6mk5ampxmvk94xd2r2q"; }; - nativeBuildInputs = [ poetry ]; - - propagatedBuildInputs = [ - setuptools + nativeBuildInputs = [ + poetry-core ]; checkInputs = [ diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index afa3972bc4db..675ddd869d74 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3056,8 +3056,10 @@ in { isodate = callPackage ../development/python-modules/isodate { }; - isort = callPackage ../development/python-modules/isort { - inherit (pkgs) poetry; + isort = if isPy3k then + callPackage ../development/python-modules/isort { } + else + callPackage ../development/python-modules/isort/4.nix { }; isoweek = callPackage ../development/python-modules/isoweek { }; |