From 6f19923a918f7fb63a444b0c99950fdbe9d2f74c Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Tue, 8 Nov 2022 11:40:39 +0100 Subject: New upstream version 20221106+py3 --- tools/cpep8.manifest | 33 +++++++++++++++ tools/cpep8.py | 22 +++++----- tools/img2thd72.py | 2 +- tools/py3_driver_progress.py | 96 ++++++++++++++++++++++++++++++++++++++++++++ tools/serialsniff.c | 2 +- 5 files changed, 142 insertions(+), 13 deletions(-) create mode 100644 tools/py3_driver_progress.py (limited to 'tools') diff --git a/tools/cpep8.manifest b/tools/cpep8.manifest index 368c6d2..57a6982 100644 --- a/tools/cpep8.manifest +++ b/tools/cpep8.manifest @@ -13,9 +13,13 @@ ./chirp/drivers/__init__.py ./chirp/drivers/alinco.py ./chirp/drivers/anytone.py +./chirp/drivers/anytone_ht.py +./chirp/drivers/anytone778uv.py ./chirp/drivers/ap510.py +./chirp/drivers/baofeng_common.py ./chirp/drivers/baofeng_uv3r.py ./chirp/drivers/baofeng_wp970i.py +./chirp/drivers/bf-t8.py ./chirp/drivers/bjuv55.py ./chirp/drivers/btech.py ./chirp/drivers/ft1500m.py @@ -33,8 +37,11 @@ ./chirp/drivers/ft857.py ./chirp/drivers/ft90.py ./chirp/drivers/ftm350.py +./chirp/drivers/ga510.py ./chirp/drivers/generic_csv.py ./chirp/drivers/generic_tpe.py +./chirp/drivers/gmrsuv1.py +./chirp/drivers/gmrsv2.py ./chirp/drivers/h777.py ./chirp/drivers/ic208.py ./chirp/drivers/ic2100.py @@ -60,33 +67,59 @@ ./chirp/drivers/id800.py ./chirp/drivers/id880.py ./chirp/drivers/idrp.py +./chirp/drivers/iradio_uv-5118.py ./chirp/drivers/kenwood_hmk.py ./chirp/drivers/kenwood_itm.py ./chirp/drivers/kenwood_live.py +./chirp/drivers/kg935g.py ./chirp/drivers/kguv8d.py +./chirp/drivers/kguv920pa.py ./chirp/drivers/kguv9dplus.py ./chirp/drivers/kyd.py ./chirp/drivers/leixen.py +./chirp/drivers/lt725uv.py +./chirp/drivers/mursv1.py ./chirp/drivers/puxing.py ./chirp/drivers/radioddity_r2.py +./chirp/drivers/radtel_t18.py +./chirp/drivers/retevis_rb15.py +./chirp/drivers/retevis_rb17p.py +./chirp/drivers/retevis_rt1.py +./chirp/drivers/retevis_rt21.py +./chirp/drivers/retevis_rt22.py +./chirp/drivers/retevis_rt23.py +./chirp/drivers/retevis_rt26.py +./chirp/drivers/retevis_rt76p.py +./chirp/drivers/retevis_rt87.py +./chirp/drivers/retevis_rt98.py ./chirp/drivers/rfinder.py +./chirp/drivers/tdxone_tdq8a.py ./chirp/drivers/template.py +./chirp/drivers/tg_uv2p.py ./chirp/drivers/th350.py ./chirp/drivers/th9800.py ./chirp/drivers/th_uv3r.py ./chirp/drivers/th_uv3r25.py ./chirp/drivers/th_uv8000.py +./chirp/drivers/th_uv88.py ./chirp/drivers/th_uvf8d.py +./chirp/drivers/th9000.py +./chirp/drivers/th9800.py ./chirp/drivers/thd72.py ./chirp/drivers/thuv1f.py +./chirp/drivers/tk760.py ./chirp/drivers/tk8102.py ./chirp/drivers/tk8180.py +./chirp/drivers/tmd710.py ./chirp/drivers/tmv71.py ./chirp/drivers/tmv71_ll.py ./chirp/drivers/ts480.py ./chirp/drivers/ts590.py ./chirp/drivers/uv5r.py +./chirp/drivers/uv5x3.py +./chirp/drivers/uv6r.py ./chirp/drivers/uvb5.py +./chirp/drivers/vgc.py ./chirp/drivers/vx170.py ./chirp/drivers/vx2.py ./chirp/drivers/vx3.py diff --git a/tools/cpep8.py b/tools/cpep8.py index 2bf55d0..b073f48 100755 --- a/tools/cpep8.py +++ b/tools/cpep8.py @@ -44,7 +44,7 @@ args = parser.parse_args() def file_to_lines(name): - fh = file(name, "r") + fh = open(name, "r") lines = fh.read().split("\n") lines.pop() fh.close() @@ -64,7 +64,7 @@ if args.scan: if f.endswith('.py'): manifest.append(filename) continue - with file(filename, "r") as fh: + with open(filename, "r") as fh: shebang = fh.readline() if shebang.startswith("#!/usr/bin/env python"): manifest.append(filename) @@ -90,25 +90,25 @@ def get_exceptions(f): return ignore if args.update: - print "Starting update of %d files" % len(manifest) + print("Starting update of %d files" % len(manifest)) bad = [] for f in manifest: checker = pep8.StyleGuide(quiet=True, ignore=get_exceptions(f)) results = checker.check_files([f]) if results.total_errors: bad.append(f) - print "%s: %s" % (results.total_errors and "FAIL" or "PASS", f) + print("%s: %s" % (results.total_errors and "FAIL" or "PASS", f)) - with file(blacklist_filename, "w") as fh: - print >>fh, """\ + with open(blacklist_filename, "w") as fh: + fh.write("""\ # cpep8.blacklist: The list of files that do not meet PEP8 standards. # DO NOT ADD NEW FILES!! Instead, fix the code to be compliant. -# Over time, this list should shrink and (eventually) be eliminated.""" - print >>fh, "\n".join(sorted(bad)) +# Over time, this list should shrink and (eventually) be eliminated.""") + fh.write("\n".join(sorted(bad))) if args.scan: - with file(manifest_filename, "w") as fh: - print >>fh, "\n".join(sorted(manifest)) + with open(manifest_filename, "w") as fh: + fh.write("\n".join(sorted(manifest))) sys.exit(0) if args.files: @@ -126,7 +126,7 @@ check_list = sorted(check_list) total_errors = 0 for f in check_list: if args.verbose: - print "Checking %s" % f + print("Checking %s" % f) checker = pep8.Checker(f, quiet=args.stats, ignore=get_exceptions(f)) results = checker.check_all() diff --git a/tools/img2thd72.py b/tools/img2thd72.py index 407bdf7..2ed1082 100644 --- a/tools/img2thd72.py +++ b/tools/img2thd72.py @@ -9,7 +9,7 @@ # by the Free Software Foundation, either version 3 of the License, or (at # your option) any later version. # -# This sofware is distributed in the hope that it will be useful, but WITHOUT +# This software is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public # License for more details. diff --git a/tools/py3_driver_progress.py b/tools/py3_driver_progress.py new file mode 100644 index 0000000..52a9e2f --- /dev/null +++ b/tools/py3_driver_progress.py @@ -0,0 +1,96 @@ +#!/usr/bin/python3 + +import argparse +import csv +import sys + +from chirp import directory + +directory.safe_import_drivers() + + +def tester_link(text): + if text.startswith('@'): + return '[%s](https://github.com/%s)' % (text, text[1:]) + elif text.startswith('+'): + assert text[1:] in directory.DRV_TO_RADIO, \ + '%s is not in the driver directory' % text[1:] + return '[Implied by %s](#user-content-%s)' % (text[1:], text[1:]) + else: + return text + + +def main(): + p = argparse.ArgumentParser() + p.add_argument('testers') + p.add_argument('-o', '--output', default='-') + args = p.parse_args() + + headers = ['Driver', 'Tester', 'Tested'] + testers = {} + + if args.output == '-': + output = sys.stdout + else: + output = open(args.output, 'w') + + line = 0 + for fields in csv.reader(open(args.testers)): + line += 1 + if fields[0][0] == '#': + continue + + if len(fields) != len(headers): + print('Error on line %i: invalid number of fields in: %s' % ( + line, ','.join(fields)), + file=sys.stderr) + return 1 + + if fields[0] in testers: + print('Error: duplicate driver %r in testers file' % fields[0], + file=sys.stderr) + return 2 + + testers[fields[0]] = fields[1:] + + print('## Status', file=output) + + print('| Driver | Tester | Tested | Byte Clean |', file=output) + print('| ------ | ------ | ------ | ---------- |', file=output) + + drivers = sorted([ident for ident in directory.DRV_TO_RADIO]) + drvstested = 0 + byteclean = 0 + for driver in drivers: + cls = directory.get_radio(driver) + tester, tested = testers.pop(driver, ('', '')) + if tester: + drvstested += 1 + if not cls.NEEDS_COMPAT_SERIAL: + byteclean += 1 + print('| %s | %s | %s | %s |' % ( + driver, driver, tester_link(tester), tested, + '' if cls.NEEDS_COMPAT_SERIAL else 'Yes'), + file=output) + + print('## Stats', file=output) + print('\n**Drivers:** %i' % (len(drivers)), file=output) + print('\n**Tested:** %i%% (%i/%i)' % ( + drvstested / len(drivers) * 100, + drvstested, len(drivers) - drvstested), + file=output) + print('\n**Byte clean:** %i%% (%i/%i)' % ( + byteclean / len(drivers) * 100, + byteclean, + len(drivers) - byteclean), + file=output) + + for driver, (tester, tested) in testers.items(): + print('Error in testers file; driver %s by %s on %s unknown' % ( + driver, tester, tested), file=sys.stderr) + if testers: + return 3 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/tools/serialsniff.c b/tools/serialsniff.c index 7a80ac4..02037d7 100644 --- a/tools/serialsniff.c +++ b/tools/serialsniff.c @@ -94,7 +94,7 @@ void hexdump(char *buf, int len, FILE *dest) * * The amendment of this procedure to support the "total_hex" variable * allows for the user to pass a command line argument instantiating a - * desired number of hexadecimal bytes (and their ASCII equivelent) to + * desired number of hexadecimal bytes (and their ASCII equivalent) to * be displayed. * */ -- cgit v1.2.3