From dbdc0095802278f807979884bd555a2ab7df8a1e Mon Sep 17 00:00:00 2001 From: Theodore Ni <3806110+tjni@users.noreply.github.com> Date: Tue, 29 Aug 2023 22:48:23 -0700 Subject: [PATCH] cpplint: patch so that tests pass on python 3.11 --- .../tools/analysis/cpplint/default.nix | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/pkgs/development/tools/analysis/cpplint/default.nix b/pkgs/development/tools/analysis/cpplint/default.nix index 7be303a52a48..87344d747bf6 100644 --- a/pkgs/development/tools/analysis/cpplint/default.nix +++ b/pkgs/development/tools/analysis/cpplint/default.nix @@ -1,18 +1,34 @@ -{ lib, python3Packages, fetchFromGitHub }: +{ lib, python3Packages, fetchFromGitHub, fetchpatch }: python3Packages.buildPythonApplication rec { pname = "cpplint"; version = "1.5.5"; + format = "setuptools"; # Fetch from github instead of pypi, since the test cases are not in the pypi archive src = fetchFromGitHub { owner = pname; repo = pname; rev = version; - sha256 = "sha256-JXz2Ufo7JSceZVqYwCRkuAsOR08znZlIUk8GCLAyiI4="; + hash = "sha256-JXz2Ufo7JSceZVqYwCRkuAsOR08znZlIUk8GCLAyiI4="; }; - patches = [ ./0001-Remove-pytest-runner-version-pin.patch ]; + patches = [ + ./0001-Remove-pytest-runner-version-pin.patch + + # The patch below stops using the sre_compile module, which was deprecated + # in Python 3.11 and replaces it with re.compile. Upstream is unsure if it + # should use re.compile or re._compiler.compile, so we should monitor the + # thread for updates. + # + # https://github.com/cpplint/cpplint/pull/214 + # + (fetchpatch { + name = "python-3.11-compatibility.patch"; + url = "https://github.com/cpplint/cpplint/commit/e84e84f53915ae2a9214e756cf89c573a73bbcd3.patch"; + hash = "sha256-u57AFWaVmGFSsvSGq1x9gZmTsuZPqXvTC7mTfyb2164="; + }) + ]; postPatch = '' patchShebangs cpplint_unittest.py