From ffd2e63e2361a2e1435f2a3cd10a4de0f8a87d59 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Sun, 1 Oct 2023 18:56:12 -0700 Subject: [PATCH] Make style checker use proper list for args The style checker currently always applies new rules to files on the argument list. This makes it use the same logic for those as "all files" mode. Also fix some style issues in tools/ scripts. --- tools/cpep8.py | 10 +++++++++- tools/fast-driver.py | 4 ++-- tools/py3_driver_progress.py | 26 ++++++++++++++++---------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/tools/cpep8.py b/tools/cpep8.py index d1aafb73..678281f6 100755 --- a/tools/cpep8.py +++ b/tools/cpep8.py @@ -100,8 +100,16 @@ def get_exceptions(f): if args.files: + old_files = cpep8_manifest cpep8_manifest = [] - flake8_manifest = args.files + flake8_manifest = [] + for fn in args.files: + if not fn.startswith('./'): + fn = './' + fn + if fn in old_files: + cpep8_manifest.append(fn) + else: + flake8_manifest.append(fn) # read the blacklisted source files blacklist = file_to_lines(blacklist_filename) diff --git a/tools/fast-driver.py b/tools/fast-driver.py index f14e9f3c..669a5e11 100755 --- a/tools/fast-driver.py +++ b/tools/fast-driver.py @@ -28,8 +28,8 @@ def find_imports(of_modules): driver_imports = [] for fn in glob.glob('chirp/drivers/*.py'): with open(fn) as f: - lines = [l for l in f.readlines() - if 'import ' in l and 'drivers' in l] + lines = [ln for ln in f.readlines() + if 'import ' in ln and 'drivers' in ln] imports = [] for line in lines: imports.extend(parse_import_line(line)) diff --git a/tools/py3_driver_progress.py b/tools/py3_driver_progress.py index 7d80ad71..78714430 100644 --- a/tools/py3_driver_progress.py +++ b/tools/py3_driver_progress.py @@ -22,10 +22,12 @@ def tester_link(text): assert os.path.exists(os.path.join('chirp', 'drivers', text[1:] + '.py')) return ('[Probably works](' - 'https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/%s.py)' % ( + 'https://github.com/kk7ds/chirp' + '/blob/py3/chirp/drivers/%s.py)' % ( text[1:])) elif text.startswith('#') and text[1:].isdigit(): - return '[Reported working](https://chirp.danplanet.com/issues/%i)' % int(text[1:]) + return ('[Reported working]' + '(https://chirp.danplanet.com/issues/%i)' % int(text[1:])) else: return text @@ -114,8 +116,10 @@ def main(): print('## Status', file=output) - print('| Driver | Tester | Tested | Byte Clean | "Market Share" |', file=output) - print('| ------ | ------ | ------ | ---------- | -------------- |', file=output) + print('| Driver | Tester | Tested | Byte Clean | "Market Share" |', + file=output) + print('| ------ | ------ | ------ | ---------- | -------------- |', + file=output) drivers = sorted([ident for ident in directory.DRV_TO_RADIO]) drvstested = 0 @@ -186,17 +190,19 @@ def main(): at least the following procedure was followed: 1. Download from the radio 1. Make some change to a memory - 1. If the radio has settings support, make sure settings load and tweak one setting + 1. If the radio has settings support, make sure settings load and tweak + one setting 1. Upload to the radio 1. Confirm that the changes stick and look correct, or at least are not a regression from the master py2 branch. - The drivers are all passing the automated tests, but tests with real hardware - and serial ports is important, especially around bytes-vs-string safety. + The drivers are all passing the automated tests, but tests with real + hardware and serial ports is important, especially around bytes-vs-string + safety. - To update this document, add/edit entries in `tests/py3_driver_testers.txt` and - then run `tox -e makesupported`. Commit the result (including the changes to this `.md` - file) and submit a PR. + To update this document, add/edit entries in `tests/py3_driver_testers.txt` + and then run `tox -e makesupported`. Commit the result (including the + changes to this `.md` file) and submit a PR. The "Byte Clean" flag refers to whether or not the radio has set the `NEEDS_COMPAT_SERIAL = False` flag on the radio class, and thus uses