Files
python-cpplint/do-not-use-codecs-open.patch
Steve Kowalik 326e8a8e1b - Update to 2.0.2:
* Drop Python 3.8
  * Don't err on non-const references by default
  * fix(indentation_namespace): false positive for MemInitLists
  * Fix missing comma between items in _CPP_HEADERS
  * Fix false positive for indented parameters in namespaces
  * IWYU: treat stdio.h the same way as cstdio
  * PEP 621: Migrate from setup.{py, cfg} to pyproject.toml
  * cpplint_clitest.py: Function names should be lowercase
  * suppress C++-only categories on C file extensions
  * You can now specify blocks of code that exclude linting with NOLINTBEGIN
    and NOLINTEND
  * The --filter option can now be only applied to a specific file or even a
    specific line through utilizing colons
  * NOLINT and NOLINTNEXTLINE comments now support a comma-separated list of
    categories
  * NOLINT and NOLINTNEXTLINE will now ignore categories known to be from
    clang-tidy
  * build/include-what-you-use no longer supports transitive headers from the
    header for the current module for parity with the style guide
  * build/include-what-you-use now supports a plethora of new functions
  * build/include-what-you-use will no longer err on similarly-named classes
    from other namespaces
  * Indented functions inside namespaces will now be correctly erred on
  * The check for C-style casts now looks for the standard fixed-width
    integer typenames instead of non-standard ones (e.g. int32_t instead of
    int32)
  * readability/braces will realize that C++20 concepts require a semicolon
  * C++20 headers will no longer be flagged as C headers
  * Processing C++ files through stdin/piping is now fixed

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cpplint?expand=0&rev=20
2025-10-31 02:28:31 +00:00

46 lines
2.0 KiB
Diff

From fe579d0e248f2f1f977ecb902f7a2eb1a4a66eef Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Fri, 31 Oct 2025 12:50:26 +1100
Subject: [PATCH 1/3] Drop use of codecs.open()
codecs.open() has been deprecated as of Python 3.14, and plain open()
supports all use-cases we have, switch to using it.
---
cpplint.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
Index: cpplint-2.0.2/cpplint.py
===================================================================
--- cpplint-2.0.2.orig/cpplint.py
+++ cpplint-2.0.2/cpplint.py
@@ -7448,7 +7448,7 @@ def ProcessConfigOverrides(filename):
continue
try:
- with codecs.open(cfg_file, "r", "utf8", "replace") as file_handle:
+ with open(cfg_file, encoding="utf8", errors="replace") as file_handle:
for line in file_handle:
line, _, _ = line.partition("#") # Remove comments.
if not line.strip():
@@ -7541,16 +7541,15 @@ def ProcessFile(filename, vlevel, extra_
crlf_lines = []
try:
# Support the UNIX convention of using "-" for stdin. Note that
- # we are not opening the file with universal newline support
- # (which codecs doesn't support anyway), so the resulting lines do
- # contain trailing '\r' characters if we are reading a file that
- # has CRLF endings.
+ # we are not opening the file with universal newline support,
+ # so the resulting lines do # contain trailing '\r' characters
+ # if we are reading a file that # has CRLF endings.
# If after the split a trailing '\r' is present, it is removed
# below.
if filename == "-":
lines = sys.stdin.read().split("\n")
else:
- with codecs.open(filename, "r", "utf8", "replace") as target_file:
+ with open(filename, encoding="utf8", errors="replace") as target_file:
lines = target_file.read().split("\n")
# Remove trailing '\r'.