From 1a7bf1d3850f7f882fd6c0284453f67bb9ec68e9 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Sun, 9 Mar 2025 17:27:38 -0400 Subject: [PATCH 1/7] drop Python 3.8 --- CHANGELOG.rst | 7 ++++++- cpplint.py | 2 +- pyproject.toml | 5 ++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 571eb2f..6f16602 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,7 +2,12 @@ Changelog ********* -2.0.1 (2025-04-02) +2.1.0 (TBA) +=========== + +* Python versions less than 3.8 are no longer supported. + +2.0.1 (2025-03-09) ================== Yet another overdue... hotfix. Sorry this took so long. diff --git a/cpplint.py b/cpplint.py index 6e2cf5d..526fabb 100755 --- a/cpplint.py +++ b/cpplint.py @@ -46,7 +46,7 @@ import codecs import collections import copy -import getopt # pylint: disable=deprecated-module +import getopt import glob import itertools import math # for log diff --git a/pyproject.toml b/pyproject.toml index f028050..e9a99fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ authors = [ { name = "Andrew Davis", email = "theandrewdavis@gmail.com" }, { name = "cpplint developers" }, ] -requires-python = ">=3.8" +requires-python = ">=3.9" classifiers = [ "Development Status :: 5 - Production/Stable", "Environment :: Console", @@ -29,7 +29,6 @@ classifiers = [ "Natural Language :: English", "Programming Language :: C++", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -43,7 +42,7 @@ dependencies = [ ] optional-dependencies.dev = [ "mypy", "parameterized", - "pylint>=2.11", + "pylint>=3.3.5", "pytest", "pytest-cov", "pytest-timeout", From 255a82307c9567409ed8f3ba22ef6fa61a5138c4 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Sun, 9 Mar 2025 17:33:42 -0400 Subject: [PATCH 2/7] of couse you'd forget --- .github/workflows/ci.yml | 4 ++-- tox.ini | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17acf31..38848d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,8 @@ jobs: strategy: fail-fast: false matrix: - # Python 3.8 is EOL. Also adapt tox.ini - python-version: ['3.8', 'pypy3.11', '3.x'] + # Also adapt tox.ini on change + python-version: ['3.9', 'pypy3.11', '3.x'] # macOS on ARM, Ubuntu on x86, Windows on X86 os: [macos-latest, ubuntu-latest, windows-latest] steps: diff --git a/tox.ini b/tox.ini index 62d43e6..f7e3911 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38, py39, py3.10, py311, py312, py313, pypy3 +envlist = py39, py310, py311, py312, py313, pypy3 skip_missing_interpreters = true From 7fcfa6ce33078f301698dd436aa67fcc86157f85 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Wed, 2 Apr 2025 20:30:03 -0400 Subject: [PATCH 3/7] Remove annotations imports from future Also, remove ruff target-version property as it detects the target version from requires-python by default. --- cpplint.py | 8 +++----- cpplint_clitest.py | 2 -- cpplint_unittest.py | 2 -- pyproject.toml | 2 -- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/cpplint.py b/cpplint.py index 526fabb..0184417 100755 --- a/cpplint.py +++ b/cpplint.py @@ -41,7 +41,7 @@ same line, but it is far from perfect (in either direction). """ -from __future__ import annotations +from __future__ import annotations # PEP 604 not in 3.9 import codecs import collections @@ -6858,8 +6858,7 @@ def FilesBelongToSameModule(filename_cc, filename_h): filename_cc = filename_cc.replace("/internal/", "/") filename_h = filename_h[: -(len(fileinfo_h.Extension()))] - if filename_h.endswith("-inl"): - filename_h = filename_h[: -len("-inl")] + filename_h = filename_h.removesuffix("-inl") filename_h = filename_h.replace("/public/", "/") filename_h = filename_h.replace("/internal/", "/") @@ -7701,8 +7700,7 @@ def _ExpandDirectories(filenames): for root, _, files in os.walk(filename): for loopfile in files: fullname = os.path.join(root, loopfile) - if fullname.startswith("." + os.path.sep): - fullname = fullname[len("." + os.path.sep) :] + fullname = fullname.removeprefix("." + os.path.sep) expanded.add(fullname) return [ diff --git a/cpplint_clitest.py b/cpplint_clitest.py index 2694712..824a07e 100755 --- a/cpplint_clitest.py +++ b/cpplint_clitest.py @@ -30,8 +30,6 @@ """Command Line interface integration test for cpplint.py.""" -from __future__ import annotations - import contextlib import glob import os diff --git a/cpplint_unittest.py b/cpplint_unittest.py index 079c7d3..d0bda8e 100755 --- a/cpplint_unittest.py +++ b/cpplint_unittest.py @@ -32,8 +32,6 @@ # TODO(unknown): Add a good test that tests UpdateIncludeState. -from __future__ import annotations - import codecs import os import platform diff --git a/pyproject.toml b/pyproject.toml index e9a99fd..11d3906 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,8 +58,6 @@ include-package-data = false dynamic.version = { attr = "cpplint.__VERSION__" } [tool.ruff] -target-version = "py38" - line-length = 100 lint.select = [ "A", # flake8-builtins From 57900f362a6d510950b03596e3afe8688c6ffaf4 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Wed, 2 Apr 2025 22:25:43 -0400 Subject: [PATCH 4/7] bump version --- cpplint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpplint.py b/cpplint.py index 0184417..6fce076 100755 --- a/cpplint.py +++ b/cpplint.py @@ -61,7 +61,7 @@ # if empty, use defaults _valid_extensions: set[str] = set() -__VERSION__ = "2.0.1" +__VERSION__ = "2.1.0" _USAGE = """ Syntax: cpplint.py [--verbose=#] [--output=emacs|eclipse|vs7|junit|sed|gsed] From 83b4e70fe55a28aa1ba1ef0377ad950dbde6046a Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 7 Apr 2025 18:39:12 +0200 Subject: [PATCH 5/7] pylint==3.3.5 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 11d3906..6245d39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ dependencies = [ ] optional-dependencies.dev = [ "mypy", "parameterized", - "pylint>=3.3.5", + "pylint==3.3.5", "pytest", "pytest-cov", "pytest-timeout", From de16be4ac8023a4a0a4f4c79c673b7cfb84a09f1 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 7 Apr 2025 18:49:08 +0200 Subject: [PATCH 6/7] pip install --editable ".[dev]" --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38848d3..59087fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install --editable .[dev] + pip install --editable ".[dev]" - name: Test with tox run: tox -e py From 366cf4e3a5ed34e21b909d2ccb9caffd50bebadb Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 7 Apr 2025 19:27:08 +0200 Subject: [PATCH 7/7] Apply suggestions from code review --- CHANGELOG.rst | 2 +- cpplint.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6f16602..022d292 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,7 +5,7 @@ Changelog 2.1.0 (TBA) =========== -* Python versions less than 3.8 are no longer supported. +* Python versions less than 3.9 are no longer supported. 2.0.1 (2025-03-09) ================== diff --git a/cpplint.py b/cpplint.py index 6fce076..0184417 100755 --- a/cpplint.py +++ b/cpplint.py @@ -61,7 +61,7 @@ # if empty, use defaults _valid_extensions: set[str] = set() -__VERSION__ = "2.1.0" +__VERSION__ = "2.0.1" _USAGE = """ Syntax: cpplint.py [--verbose=#] [--output=emacs|eclipse|vs7|junit|sed|gsed] diff --git a/pyproject.toml b/pyproject.toml index 6245d39..32bccef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ dependencies = [ ] optional-dependencies.dev = [ "mypy", "parameterized", - "pylint==3.3.5", + "pylint>=3.3.4", "pytest", "pytest-cov", "pytest-timeout",