1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, isPy27
5, isPy38
6, isPy39
7, pythonAtLeast
8, flake8
9, six
10, python
11}:
12
13buildPythonPackage rec {
14 pname = "flake8-future-import";
15 version = "0.4.6";
16
17 # PyPI tarball doesn't include the test suite
18 src = fetchFromGitHub {
19 owner = "xZise";
20 repo = "flake8-future-import";
21 rev = version;
22 sha256 = "00q8n15xdnvqj454arn7xxksyrzh0dw996kjyy7g9rdk0rf8x82z";
23 };
24
25 patches = lib.optionals (pythonAtLeast "3.10") [
26 ./fix-annotations-version-11.patch
27 ] ++ lib.optionals (isPy38 || isPy39) [
28 ./fix-annotations-version-10.patch
29 ] ++ lib.optionals isPy27 [
30 # Upstream disables this test case naturally on python 3, but it also fails
31 # inside NixPkgs for python 2. Since it's going to be deleted, we just skip it
32 # on py2 as well.
33 ./skip-test.patch
34 ];
35
36 propagatedBuildInputs = [ flake8 ];
37
38 checkInputs = [ six ];
39
40 checkPhase = ''
41 ${python.interpreter} -m test_flake8_future_import
42 '';
43
44 meta = with lib; {
45 description = "A flake8 extension to check for the imported __future__ modules to make it easier to have a consistent code base";
46 homepage = "https://github.com/xZise/flake8-future-import";
47 license = licenses.mit;
48 };
49}