1{
2 lib,
3 python3,
4 fetchPypi,
5 fetchFromGitHub,
6 clang,
7 clang-tools,
8 cppcheck,
9 gcc,
10 makeWrapper,
11 withClang ? false,
12 withClangTools ? false,
13 withCppcheck ? false,
14 withGcc ? false,
15}:
16let
17 python = python3.override {
18 packageOverrides = self: super: rec {
19 # codechecker is incompatible with SQLAlchemy greater than 1.3
20 sqlalchemy = super.sqlalchemy_1_4.overridePythonAttrs (oldAttrs: rec {
21 version = "1.3.23";
22 pname = oldAttrs.pname;
23 src = fetchFromGitHub {
24 owner = "sqlalchemy";
25 repo = "sqlalchemy";
26 rev = "rel_${lib.replaceStrings [ "." ] [ "_" ] version}";
27 hash = "sha256-hWA0/f7rQpEfYTg10i0rBK3qeJbw3p6HW7S59rLnD0Q=";
28 };
29 doCheck = false;
30 # That test does not exist in the 1.3 branch so we get an error for disabling it
31 disabledTestPaths = builtins.filter (
32 testPath: testPath != "test/ext/mypy"
33 ) oldAttrs.disabledTestPaths;
34 });
35 sqlalchemy_1_4 = sqlalchemy;
36
37 # The current alembic version is not compatible with SQLAlchemy 1.3 so we need to downgrade it
38 alembic = super.alembic.overridePythonAttrs (oldAttrs: rec {
39 pname = "alembic";
40 version = "1.5.5";
41 src = fetchPypi {
42 inherit pname version;
43 hash = "sha256-3wAowZJ1os/xN+OWF6Oc3NvRFzczuHtr+iV7fAhgITs=";
44 };
45 doCheck = false;
46 dependencies = oldAttrs.dependencies ++ [
47 super.python-dateutil
48 super.python-editor
49 ];
50 });
51 };
52 };
53 python3Packages = python.pkgs;
54in
55python3Packages.buildPythonApplication rec {
56 pname = "codechecker";
57 version = "6.24.0";
58 pyproject = true;
59
60 src = fetchPypi {
61 inherit pname version;
62 hash = "sha256-ftZACUf2lAHokcUXj45LRA7/3goOcIy521cGl6qhR98=";
63 };
64
65 nativeBuildInputs = with python3Packages; [
66 setuptools
67 pythonRelaxDepsHook
68 ];
69
70 propagatedBuildInputs = with python3Packages; [
71 distutils # required in python312 to call subcommands (see https://github.com/Ericsson/codechecker/issues/4350)
72 lxml
73 sqlalchemy
74 alembic
75 portalocker
76 psutil
77 multiprocess
78 thrift
79 gitpython
80 types-pyyaml
81 sarif-tools
82 pytest
83 pycodestyle
84 pylint
85 mkdocs
86 coverage
87 ];
88
89 pythonRelaxDeps = [
90 "thrift"
91 "portalocker"
92 "types-pyyaml"
93 "lxml"
94 "psutil"
95 "multiprocess"
96 "gitpython"
97 "sarif-tools"
98 "pyyaml"
99 ];
100
101 postInstall = ''
102 wrapProgram "$out/bin/CodeChecker" --prefix PATH : ${
103 lib.makeBinPath (
104 [ ]
105 ++ lib.optional withClang clang
106 ++ lib.optional withClangTools clang-tools
107 ++ lib.optional withCppcheck cppcheck
108 ++ lib.optional withGcc gcc
109 )
110 }
111 '';
112
113 meta = {
114 homepage = "https://github.com/Ericsson/codechecker";
115 changelog = "https://github.com/Ericsson/codechecker/releases/tag/v${version}";
116 description = "Analyzer tooling, defect database and viewer extension for the Clang Static Analyzer and Clang Tidy";
117 license = with lib.licenses; [
118 asl20
119 llvm-exception
120 ];
121 maintainers = with lib.maintainers; [
122 zebreus
123 felixsinger
124 ];
125 mainProgram = "CodeChecker";
126 platforms = lib.platforms.darwin ++ lib.platforms.linux;
127 };
128}