nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv
2, lib
3, buildPythonPackage
4, fetchFromGitHub
5, pythonAtLeast
6, pythonOlder
7, installShellFiles
8, astroid
9, dill
10, isort
11, mccabe
12, platformdirs
13, tomli
14, typing-extensions
15, GitPython
16, pytest-benchmark
17, pytest-timeout
18, pytest-xdist
19, pytestCheckHook
20}:
21
22buildPythonPackage rec {
23 pname = "pylint";
24 version = "2.13.5";
25 format = "setuptools";
26
27 disabled = pythonOlder "3.6.2";
28
29 src = fetchFromGitHub {
30 owner = "PyCQA";
31 repo = pname;
32 rev = "v${version}";
33 sha256 = "sha256-FB99vmUtoTc0cTjDUSbx80Tesh0vASigSpPktrDYk08=";
34 };
35
36 nativeBuildInputs = [
37 installShellFiles
38 ];
39
40 propagatedBuildInputs = [
41 astroid
42 dill
43 isort
44 mccabe
45 platformdirs
46 ] ++ lib.optionals (pythonOlder "3.11") [
47 tomli
48 ] ++ lib.optionals (pythonOlder "3.9") [
49 typing-extensions
50 ];
51
52 postInstall = ''
53 mkdir -p $out/share/emacs/site-lisp
54 cp -v "elisp/"*.el $out/share/emacs/site-lisp/
55 installManPage man/*.1
56 '';
57
58 checkInputs = [
59 GitPython
60 # https://github.com/PyCQA/pylint/blob/main/requirements_test_min.txt
61 pytest-benchmark
62 pytest-timeout
63 pytest-xdist
64 pytestCheckHook
65 typing-extensions
66 ];
67
68 dontUseSetuptoolsCheck = true;
69
70 # calls executable in one of the tests
71 preCheck = ''
72 export PATH=$PATH:$out/bin
73 export HOME=$TEMPDIR
74 '';
75
76 disabledTestPaths = [
77 # tests miss multiple input files
78 # FileNotFoundError: [Errno 2] No such file or directory
79 "tests/pyreverse/test_writer.py"
80 ];
81
82 disabledTests = lib.optionals stdenv.isDarwin [
83 "test_parallel_execution"
84 "test_py3k_jobs_option"
85 ];
86
87 meta = with lib; {
88 homepage = "https://pylint.pycqa.org/";
89 description = "A bug and style checker for Python";
90 longDescription = ''
91 Pylint is a Python static code analysis tool which looks for programming errors,
92 helps enforcing a coding standard, sniffs for code smells and offers simple
93 refactoring suggestions.
94 Pylint is shipped with following additional commands:
95 - pyreverse: an UML diagram generator
96 - symilar: an independent similarities checker
97 - epylint: Emacs and Flymake compatible Pylint
98 '';
99 license = licenses.gpl1Plus;
100 maintainers = with maintainers; [ totoroot ];
101 };
102}