1{ lib
2, buildPythonPackage
3, fetchPypi
4, pythonOlder
5, configparser
6, enum34
7, mccabe
8, pycodestyle
9, pyflakes
10, functools32
11, typing
12, importlib-metadata
13, mock
14, pytestCheckHook
15}:
16
17buildPythonPackage rec {
18 pname = "flake8";
19 version = "4.0.1";
20
21 src = fetchPypi {
22 inherit pname version;
23 sha256 = "03c7mnk34wfz7a0m5zq0273y94awz69fy5iww8alh4a4v96h6vl0";
24 };
25
26 postPatch = ''
27 substituteInPlace setup.cfg \
28 --replace "pyflakes >= 2.3.0, < 2.4.0" "pyflakes >= 2.3.0, < 2.5.0"
29 '';
30
31 propagatedBuildInputs = [
32 pyflakes
33 pycodestyle
34 mccabe
35 ] ++ lib.optionals (pythonOlder "3.2") [
36 configparser
37 functools32
38 ] ++ lib.optionals (pythonOlder "3.4") [
39 enum34
40 ] ++ lib.optionals (pythonOlder "3.5") [
41 typing
42 ] ++ lib.optionals (pythonOlder "3.8") [
43 importlib-metadata
44 ];
45
46 # Tests fail on Python 3.7 due to importlib using a deprecated interface
47 doCheck = !(pythonOlder "3.8");
48
49 checkInputs = [
50 mock
51 pytestCheckHook
52 ];
53
54 meta = with lib; {
55 description = "Flake8 is a wrapper around pyflakes, pycodestyle and mccabe.";
56 homepage = "https://github.com/pycqa/flake8";
57 license = licenses.mit;
58 maintainers = with maintainers; [ ];
59 };
60}