1{ lib, python3Packages, fetchFromGitHub }:
2
3python3Packages.buildPythonApplication rec {
4 pname = "cpplint";
5 version = "1.6.1";
6 pyproject = true;
7
8 # Fetch from github instead of pypi, since the test cases are not in the pypi archive
9 src = fetchFromGitHub {
10 owner = "cpplint";
11 repo = "cpplint";
12 rev = "refs/tags/${version}";
13 hash = "sha256-N5YrlhEXQGYxhsJ4M5dGYZUzA81GKRSI83goaqbtCkI=";
14 };
15
16 postPatch = ''
17 substituteInPlace setup.py \
18 --replace-fail '"pytest-runner==5.2"' ""
19
20 patchShebangs cpplint_unittest.py
21
22 substituteInPlace cpplint_unittest.py \
23 --replace-fail "assertEquals" "assertEqual"
24 '';
25
26 build-system = with python3Packages; [
27 setuptools
28 ];
29
30 nativeCheckInputs = with python3Packages; [
31 pytest
32 pytest-runner
33 ];
34
35 checkPhase = ''
36 ./cpplint_unittest.py
37 '';
38
39 meta = {
40 homepage = "https://github.com/cpplint/cpplint";
41 description = "Static code checker for C++";
42 mainProgram = "cpplint";
43 maintainers = [ lib.maintainers.bhipple ];
44 license = [ lib.licenses.bsd3 ];
45 };
46}