From 0e855087765db4cbe8283f614238aaa0dba74ff6 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Sun, 4 Feb 2024 06:33:12 +0800 Subject: [PATCH] Fix support for Python 3.12 Removes 'lint' subcommand support from setup.py --- .github/workflows/ci.yml | 2 +- CONTRIBUTING.rst | 10 +++++----- cpplint_unittest.py | 2 +- setup.py | 38 +------------------------------------- test-requirements | 1 - tox.ini | 9 +++++---- 6 files changed, 13 insertions(+), 49 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd362e3..2edda37 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.9', 'pypy3.10', '3.11'] + python-version: ['3.9', 'pypy3.10', '3.11', '3.12'] fail-fast: false steps: diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index fc09522..db91dbb 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -62,11 +62,11 @@ You can setup your local environment for developing patches for cpplint like thi # run a single CLI integration test pytest --no-cov cpplint_clitest.py -k testSillySample # run all tests - ./setup.py test - ./setup.py lint - ./setup.py ci # all the above - ./flake8 - tox # all of the above in all python environments + pytest + pylint cpplint.py + flake8 + # all of the above in all python environments + tox Releasing --------- diff --git a/cpplint_unittest.py b/cpplint_unittest.py index 4bab1c9..9a47259 100755 --- a/cpplint_unittest.py +++ b/cpplint_unittest.py @@ -935,7 +935,7 @@ def testIncludeWhatYouUseNoImplementationFiles(self): code = 'std::vector foo;' for extension in ['h', 'hpp', 'hxx', 'h++', 'cuh', 'c', 'cc', 'cpp', 'cxx', 'c++', 'cu']: - self.assertEquals('Add #include for vector<>' + self.assertEqual('Add #include for vector<>' ' [build/include_what_you_use] [4]', self.PerformIncludeWhatYouUse(code, 'foo.' + extension)) diff --git a/setup.py b/setup.py index b7539dc..e428244 100755 --- a/setup.py +++ b/setup.py @@ -1,40 +1,7 @@ #! /usr/bin/env python - -from setuptools import setup, Command -from subprocess import check_call -from distutils.spawn import find_executable +from setuptools import setup import cpplint as cpplint -class Cmd(Command): - ''' - Superclass for other commands to run via setup.py, declared in setup.cfg. - These commands will auto-install setup_requires in a temporary folder. - ''' - user_options = [ - ('executable', 'e', 'The executable to use for the command') - ] - - def initialize_options(self): - self.executable = find_executable(self.executable) - - def finalize_options(self): - pass - - def execute(self, *k): - check_call((self.executable,) + k) - - -class Lint(Cmd): - '''run with python setup.py lint''' - description = 'Run linting of the code' - user_options = Cmd.user_options + [ - ('jobs', 'j', 'Use multiple processes to speed up the linting') - ] - executable = 'pylint' - - def run(self): - self.execute('cpplint.py') - # some pip versions bark on comments (e.g. on travis) def read_without_comments(filename): with open(filename) as f: @@ -78,7 +45,4 @@ def read_without_comments(filename): extras_require={ 'test': test_required, 'dev': read_without_comments('dev-requirements') + test_required - }, - cmdclass={ - 'lint': Lint }) diff --git a/test-requirements b/test-requirements index 50f6fb3..8e557c8 100644 --- a/test-requirements +++ b/test-requirements @@ -2,5 +2,4 @@ # 5.x requires python 3.5 pytest pytest-cov -# freeze versions breaking python 2.7 on travis testfixtures diff --git a/tox.ini b/tox.ini index 400f528..7921414 100644 --- a/tox.ini +++ b/tox.ini @@ -1,4 +1,3 @@ -# also see gitlab ci.yml [tox] envlist = py39, py310, py312, pypy3 @@ -16,9 +15,11 @@ deps = pylint>=2.11.0 flake8-polyfill pytest + pytest-cov + testfixtures setuptools==58.2.0 commands = - {envpython} setup.py test - {envpython} setup.py lint - {envpython} -m flake8 \ No newline at end of file + {envpython} -m pytest + {envpython} -m pylint cpplint.py + {envpython} -m flake8