Commit b4071a96 authored by Gaetan Lepage's avatar Gaetan Lepage Committed by Gaétan Lepage
Browse files
parent 4dfb8fcd
Loading
Loading
Loading
Loading
+14 −23
Original line number Diff line number Diff line
{
  lib,
  fetchpatch,
  python3Packages,
  fetchFromGitHub,
  versionCheckHook,
}:

python3Packages.buildPythonApplication rec {
  pname = "cpplint";
  version = "1.7.0";
  version = "2.0.0";
  pyproject = true;

  # Fetch from github instead of pypi, since the test cases are not in the pypi archive
  src = fetchFromGitHub {
    owner = "cpplint";
    repo = "cpplint";
    # Commit where version was bumped to 1.7.0, no tag available
    rev = "8f62396aff6dc850415cbe5ed7edf9dc95f4a731";
    hash = "sha256-EKD7vkxJjoKWfPrXEQRA0X3PyAoYXi9wGgUFT1zC4WM=";
    rev = "refs/tags/${version}";
    hash = "sha256-076363ZwcriPb+Fn9S5jay8oL+LlBTNh+IqQRCAndRo=";
  };

  patches = [
    # Whitespace fixes that make the tests pass
    (fetchpatch {
      url = "https://github.com/cpplint/cpplint/commit/fd257bd78db02888cf6b5985ab8f53d6b765704f.patch";
      hash = "sha256-BNyW8QEY9fUe2zMG4RZzBHASaIsu4d2FJt5rX3VgkrQ=";
    })
  ];

  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail '"pytest-runner==5.2"' ""

    patchShebangs cpplint_unittest.py
    substituteInPlace setup.cfg \
      --replace-fail "pytest-cov" "" \
      --replace-fail "--cov-fail-under=90 --cov=cpplint" ""
  '';

  build-system = with python3Packages; [
@@ -39,16 +28,18 @@ python3Packages.buildPythonApplication rec {
  ];

  nativeCheckInputs = with python3Packages; [
    pytest
    parameterized
    pytestCheckHook
    pytest-timeout
    testfixtures
    versionCheckHook
  ];

  checkPhase = ''
    ./cpplint_unittest.py
  '';
  versionCheckProgramArg = [ "--version" ];

  meta = {
    homepage = "https://github.com/cpplint/cpplint";
    description = "Static code checker for C++";
    changelog = "https://github.com/cpplint/cpplint/releases/tag/${version}";
    mainProgram = "cpplint";
    maintainers = [ lib.maintainers.bhipple ];
    license = [ lib.licenses.bsd3 ];