[calm - Cygwin server-side packaging maintenance script] branch master, updated. 20220704-10-g9395d17
Jon TURNEY via Cygwin-apps-cvs <[email protected]> Mon, 15 Aug 2022 12:14:30 +0000 (GMT)
| Newsgroups | gmane.os.cygwin.cvs.apps |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=9395d1743960f7418acb8d9545da777188cefa55 commit 9395d1743960f7418acb8d9545da777188cefa55 Author: Jon Turney <[email protected]> Date: Mon Aug 15 13:10:32 2022 +0100 Fix E275 missing whitespace after keyword Drop parentheses, as assert is a keyword, not a function, so we are currently asserting on a non-empty tuple, which is always true. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=15fcdc8ba92dbcbd688204a5db35d4499911e48e commit 15fcdc8ba92dbcbd688204a5db35d4499911e48e Author: Jon Turney <[email protected]> Date: Mon Aug 15 13:04:16 2022 +0100 Fix flake8-import-order warnings https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=70f71d2b693039387ef2f332b08effb22df93fa9 commit 70f71d2b693039387ef2f332b08effb22df93fa9 Author: Jon Turney <[email protected]> Date: Mon Aug 15 12:41:41 2022 +0100 Drop version constraint on flake-import-order That version isn't compatible with current flake8 (and doesn't seem to have been working for a while...) https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=7157342b6c04ce3dfeace4ba92053e6e4793b21a commit 7157342b6c04ce3dfeace4ba92053e6e4793b21a Author: Jon Turney <[email protected]> Date: Mon Aug 15 10:59:41 2022 +0100 Report non-exception errors from license.expression.validate() Also make that error reporting a bit more consistent Also allow hint checker to be run on src.hint files Diff: --- calm/calm.py | 6 +++--- calm/find-duplicates.py | 3 ++- calm/fix-annotate-perl-hint.py | 1 + calm/fixes.py | 3 ++- calm/hint-migrate.py | 2 +- calm/hint.py | 16 ++++++++++------ calm/maintainers.py | 2 +- calm/mkgitoliteconf.py | 2 +- calm/movelist.py | 2 +- calm/package.py | 9 +++++---- calm/pkg2html.py | 3 ++- calm/repology.py | 3 +-- calm/spelling.py | 1 + calm/uploads.py | 7 ++++--- calm/utils.py | 1 - requirements.txt | 2 +- test/test_calm.py | 2 +- 17 files changed, 37 insertions(+), 28 deletions(-) diff --git a/calm/calm.py b/calm/calm.py index 04db081..196d29b 100755 --- a/calm/calm.py +++ b/calm/calm.py @@ -63,9 +63,6 @@ import sys import tempfile import time -from .abeyance_handler import AbeyanceHandler -from .buffering_smtp_handler import BufferingSMTPHandler -from .movelist import MoveList from . import common_constants from . import db from . import irk @@ -78,6 +75,9 @@ from . import reports from . import setup_exe from . import uploads from . import utils +from .abeyance_handler import AbeyanceHandler +from .buffering_smtp_handler import BufferingSMTPHandler +from .movelist import MoveList # diff --git a/calm/find-duplicates.py b/calm/find-duplicates.py index 9e1aabb..59d8012 100644 --- a/calm/find-duplicates.py +++ b/calm/find-duplicates.py @@ -23,10 +23,11 @@ import argparse import hashlib -import re import os +import re import sys import tarfile + import xtarfile from . import common_constants diff --git a/calm/fix-annotate-perl-hint.py b/calm/fix-annotate-perl-hint.py index 6959535..ea21bea 100644 --- a/calm/fix-annotate-perl-hint.py +++ b/calm/fix-annotate-perl-hint.py @@ -28,6 +28,7 @@ import re import shutil import sys import tarfile + import xtarfile from . import common_constants diff --git a/calm/fixes.py b/calm/fixes.py index e7f8146..f147be2 100644 --- a/calm/fixes.py +++ b/calm/fixes.py @@ -28,8 +28,9 @@ import re import shutil import socket import tarfile -import urllib.request import urllib.error +import urllib.request + import xtarfile from . import hint diff --git a/calm/hint-migrate.py b/calm/hint-migrate.py index e06edc6..43c5ae9 100644 --- a/calm/hint-migrate.py +++ b/calm/hint-migrate.py @@ -22,8 +22,8 @@ # import argparse -import re import os +import re import shutil import sys diff --git a/calm/hint.py b/calm/hint.py index 363cfb4..ace6ecd 100755 --- a/calm/hint.py +++ b/calm/hint.py @@ -25,9 +25,9 @@ # parser for .hint files # -from collections import OrderedDict import argparse import re +from collections import OrderedDict try: import license_expression @@ -215,7 +215,7 @@ def hint_file_parse(fn, kind, strict=False): errors = [] warnings = [] - assert((kind in hintkeys) or (kind is None)) + assert (kind in hintkeys) or (kind is None) with open(fn, 'rb') as f: c = f.read() @@ -299,10 +299,14 @@ def hint_file_parse(fn, kind, strict=False): try: licensing.parse(value, strict=True) le = licensing.validate(value, strict=True) - except (license_expression.ExpressionParseError, license_expression.ExpressionError) as e: - errors.append('value for key %s not a valid license expression: %s' % (key, e)) + except license_expression.ExpressionParseError as e: + errors.append('errors parsing license expression: %s' % (e)) + except license_expression.ExpressionError as e: + errors.append('errors validating license expression: %s' % (e)) else: - if le.original_expression != le.normalized_expression: + if not le.normalized_expression: + errors.append('errors in license expression: %s' % (le.errors)) + elif le.original_expression != le.normalized_expression: errors.append("license expression: '%s' normalizes to '%s'" % (value, le.normalized_expression)) # warn if value starts with a quote followed by whitespace @@ -415,7 +419,7 @@ def main(args): status = 0 for fn in args.files: - hints = hint_file_parse(fn, pvr) + hints = hint_file_parse(fn, spvr if fn.endswith('src.hint') else pvr) if args.verbose > 1: print(hints) diff --git a/calm/maintainers.py b/calm/maintainers.py index deac250..0a8225a 100644 --- a/calm/maintainers.py +++ b/calm/maintainers.py @@ -40,11 +40,11 @@ # list (and it's inversion) and accessors, and invalidate that stored list when # cygwin-pkg-maint changes... -from collections import defaultdict import itertools import logging import os import re +from collections import defaultdict from . import utils diff --git a/calm/mkgitoliteconf.py b/calm/mkgitoliteconf.py index 1655134..7b52dea 100755 --- a/calm/mkgitoliteconf.py +++ b/calm/mkgitoliteconf.py @@ -25,9 +25,9 @@ # mkgitoliteconf - creates a gitolite conf file fragment from cygwin-pkg-maint # -from collections import defaultdict import argparse import sys +from collections import defaultdict from . import common_constants from . import maintainers diff --git a/calm/movelist.py b/calm/movelist.py index 6101271..e4cb2e9 100644 --- a/calm/movelist.py +++ b/calm/movelist.py @@ -23,8 +23,8 @@ import logging import os - from collections import defaultdict + from . import logfilters from . import utils diff --git a/calm/package.py b/calm/package.py index 14295af..7d68856 100755 --- a/calm/package.py +++ b/calm/package.py @@ -25,8 +25,6 @@ # utilities for working with a package database # -from collections import defaultdict -from enum import Enum, IntEnum, unique import copy import difflib import hashlib @@ -37,14 +35,17 @@ import pprint import re import textwrap import time +from collections import defaultdict +from enum import Enum, IntEnum, unique + import xtarfile -from .version import SetupVersion -from .movelist import MoveList from . import common_constants from . import hint from . import maintainers from . import past_mistakes +from .movelist import MoveList +from .version import SetupVersion # kinds of packages diff --git a/calm/pkg2html.py b/calm/pkg2html.py index 04e0836..f6a2ada 100755 --- a/calm/pkg2html.py +++ b/calm/pkg2html.py @@ -50,13 +50,14 @@ import string import sys import textwrap import time + import xtarfile -from .version import SetupVersion from . import common_constants from . import maintainers from . import package from . import utils +from .version import SetupVersion # diff --git a/calm/repology.py b/calm/repology.py index 16d285b..45a0da6 100644 --- a/calm/repology.py +++ b/calm/repology.py @@ -26,12 +26,11 @@ # may not exist for some packages, e.g. where upstream doesn't do releases) # -from collections import namedtuple - import json import logging import time import urllib.request +from collections import namedtuple from .version import SetupVersion diff --git a/calm/spelling.py b/calm/spelling.py index 505c1fb..77464d7 100644 --- a/calm/spelling.py +++ b/calm/spelling.py @@ -22,6 +22,7 @@ # import re + from enchant import DictWithPWL from enchant.checker import SpellChecker from enchant.tokenize import Filter diff --git a/calm/uploads.py b/calm/uploads.py index 3bb8faa..db26f80 100644 --- a/calm/uploads.py +++ b/calm/uploads.py @@ -25,19 +25,20 @@ # upload directory processing # -from collections import defaultdict, namedtuple import filecmp -import os import logging +import os import re import shutil import time +from collections import defaultdict, namedtuple + import xtarfile -from .movelist import MoveList from . import common_constants from . import fixes from . import package +from .movelist import MoveList # reminders will be issued weekly REMINDER_INTERVAL = 60 * 60 * 24 * 7 diff --git a/calm/utils.py b/calm/utils.py index bafc5ff..fb95cc6 100644 --- a/calm/utils.py +++ b/calm/utils.py @@ -29,7 +29,6 @@ import filecmp import logging import os import subprocess - from contextlib import contextmanager diff --git a/requirements.txt b/requirements.txt index 1f4e625..b75566e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ flake8 flake8-blind-except flake8-bugbear ; python_version >= "3.5" flake8-builtins -flake8-import-order == 0.14.1 +flake8-import-order license_expression lockfile pycodestyle diff --git a/test/test_calm.py b/test/test_calm.py index e34ac99..ded5f27 100755 --- a/test/test_calm.py +++ b/test/test_calm.py @@ -39,7 +39,6 @@ import tempfile import types import unittest -from calm.version import SetupVersion import calm.calm import calm.common_constants as common_constants import calm.hint as hint @@ -47,6 +46,7 @@ import calm.maintainers as maintainers import calm.package as package import calm.pkg2html as pkg2html import calm.uploads as uploads +from calm.version import SetupVersion ARGDIRS = ['rel_area', 'homedir', 'htdocs', 'stagingdir', 'vault']