summary refs log tree commit diff
path: root/pkgs/development/python-modules/flake8-future-import/default.nix
blob: 41e9680937db6a3cdaf5ebe4cada01d3dfc91b4c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{ lib
, buildPythonPackage
, fetchFromGitHub
, pythonAtLeast
, isPy27
, flake8
, six
, python
}:

buildPythonPackage rec {
  pname = "flake8-future-import";
  version = "0.4.6";

  # PyPI tarball doesn't include the test suite
  src = fetchFromGitHub {
    owner = "xZise";
    repo = "flake8-future-import";
    rev = version;
    sha256 = "00q8n15xdnvqj454arn7xxksyrzh0dw996kjyy7g9rdk0rf8x82z";
  };

  patches = lib.optionals (pythonAtLeast "3.8") [
    ./fix-annotations-version.patch
  ] ++ lib.optionals isPy27 [
    # Upstream disables this test case naturally on python 3, but it also fails
    # inside NixPkgs for python 2. Since it's going to be deleted, we just skip it
    # on py2 as well.
    ./skip-test.patch
  ];

  propagatedBuildInputs = [ flake8 ];

  checkInputs = [ six ];

  checkPhase = ''
    ${python.interpreter} -m test_flake8_future_import
  '';

  meta = with lib; {
    description = "A flake8 extension to check for the imported __future__ modules to make it easier to have a consistent code base";
    homepage = "https://github.com/xZise/flake8-future-import";
    license = licenses.mit;
  };
}