diff options
author | Oliver Smith <ollieparanoid@postmarketos.org> | 2020-04-11 16:07:05 +0000 |
---|---|---|
committer | Rasmus Thomsen <oss@cogitri.dev> | 2020-04-11 16:07:05 +0000 |
commit | fad3ee74992b745446cd8c068053015609ef9094 (patch) | |
tree | 30de23d6265f765d35fbbbd9b61c1058e61389d5 | |
parent | c0ff3206db55e2f4aca40418b322e22c3b4ce71d (diff) | |
download | aports-fad3ee74992b745446cd8c068053015609ef9094.tar.bz2 aports-fad3ee74992b745446cd8c068053015609ef9094.tar.xz |
community/py3-flake8: fix pyflakes incompatibility
flake8 refuses to start with pyflakes 2.2.x. Work around this, without
downgrading pyflakes, by shipping the current master of flake8 and the
unmerged patch that makes it compatible with 2.2.x. I've tried to apply
the patch on top of the latest release, but that did not work. This
version appears to be working fine however, and I think it's the best we
can do in this situation. I'll add a warning to py3-pyflakes to prevent
this in the future.
Related: https://gitlab.com/pycqa/flake8/-/merge_requests/417
Fixes: #11378
-rw-r--r-- | community/py3-flake8/0001-Support-pyflakes-2.2.x.patch | 119 | ||||
-rw-r--r-- | community/py3-flake8/APKBUILD | 15 | ||||
-rw-r--r-- | community/py3-pyflakes/APKBUILD | 1 |
3 files changed, 130 insertions, 5 deletions
diff --git a/community/py3-flake8/0001-Support-pyflakes-2.2.x.patch b/community/py3-flake8/0001-Support-pyflakes-2.2.x.patch new file mode 100644 index 0000000000..0c27beacc4 --- /dev/null +++ b/community/py3-flake8/0001-Support-pyflakes-2.2.x.patch @@ -0,0 +1,119 @@ +From af16abbe3ab1f09221e5b754624e1db35c1b0711 Mon Sep 17 00:00:00 2001 +From: Anthony Sottile <asottile@umich.edu> +Date: Fri, 10 Apr 2020 18:53:10 -0700 +Subject: [PATCH] Support pyflakes 2.2.x + +--- + docs/source/user/error-codes.rst | 35 +++++++++++++++++++++++++++++++- + setup.cfg | 2 +- + src/flake8/plugins/pyflakes.py | 16 +++++++++++++++ + 3 files changed, 51 insertions(+), 2 deletions(-) + +diff --git a/docs/source/user/error-codes.rst b/docs/source/user/error-codes.rst +index 1bc3d7f..41341b1 100644 +--- a/docs/source/user/error-codes.rst ++++ b/docs/source/user/error-codes.rst +@@ -29,6 +29,37 @@ generates its own :term:`error code`\ s for ``pyflakes``: + | F407 | an undefined ``__future__`` feature name was imported | + +------+---------------------------------------------------------------------+ + +------+---------------------------------------------------------------------+ ++| F501 | invalid ``%`` format literal | +++------+---------------------------------------------------------------------+ ++| F502 | ``%`` format expected mapping but got sequence | +++------+---------------------------------------------------------------------+ ++| F503 | ``%`` format expected sequence but got mapping | +++------+---------------------------------------------------------------------+ ++| F504 | ``%`` format unused named arguments | +++------+---------------------------------------------------------------------+ ++| F505 | ``%`` format missing named arguments | +++------+---------------------------------------------------------------------+ ++| F506 | ``%`` format mixed positional and named arguments | +++------+---------------------------------------------------------------------+ ++| F507 | ``%`` format mismatch of placeholder and argument count | +++------+---------------------------------------------------------------------+ ++| F508 | ``%`` format with ``*`` specifier requires a sequence | +++------+---------------------------------------------------------------------+ ++| F509 | ``%`` format with unsupported format character | +++------+---------------------------------------------------------------------+ ++| F520 | ``.format(...)`` invalid format string | +++------+---------------------------------------------------------------------+ ++| F521 | ``.format(...)`` unused named arguments | +++------+---------------------------------------------------------------------+ ++| F522 | ``.format(...)`` unused positional arguments | +++------+---------------------------------------------------------------------+ ++| F523 | ``.format(...)`` missing argument | +++------+---------------------------------------------------------------------+ ++| F524 | ``.format(...)`` mixing automatic and manual numbering | +++------+---------------------------------------------------------------------+ ++| F540 | f-string without any placeholders | +++------+---------------------------------------------------------------------+ +++------+---------------------------------------------------------------------+ + | F601 | dictionary key ``name`` repeated with different values | + +------+---------------------------------------------------------------------+ + | F602 | dictionary key variable ``name`` repeated with different values | +@@ -37,12 +68,14 @@ generates its own :term:`error code`\ s for ``pyflakes``: + +------+---------------------------------------------------------------------+ + | F622 | two or more starred expressions in an assignment ``(a, *b, *c = d)``| + +------+---------------------------------------------------------------------+ +-| F631 | assertion test is a tuple, which are always ``True`` | ++| F631 | assertion test is a tuple, which is always ``True`` | + +------+---------------------------------------------------------------------+ + | F632 | use ``==/!=`` to compare ``str``, ``bytes``, and ``int`` literals | + +------+---------------------------------------------------------------------+ + | F633 | use of ``>>`` is invalid with ``print`` function | + +------+---------------------------------------------------------------------+ ++| F634 | if test is a tuple, which is always ``True`` | +++------+---------------------------------------------------------------------+ + +------+---------------------------------------------------------------------+ + | F701 | a ``break`` statement outside of a ``while`` or ``for`` loop | + +------+---------------------------------------------------------------------+ +diff --git a/setup.cfg b/setup.cfg +index f482ec0..58b4dc0 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -41,7 +41,7 @@ install_requires= + # http://flake8.pycqa.org/en/latest/faq.html#why-does-flake8-use-ranges-for-its-dependencies + # And in which releases we will update those ranges here: + # http://flake8.pycqa.org/en/latest/internal/releases.html#releasing-flake8 +- pyflakes >= 2.1.0, < 2.2.0 ++ pyflakes >= 2.2.0, < 2.3.0 + pycodestyle >= 2.5.0, < 2.6.0 + mccabe >= 0.6.0, < 0.7.0 + enum34; python_version<"3.4" +diff --git a/src/flake8/plugins/pyflakes.py b/src/flake8/plugins/pyflakes.py +index b216b62..54a8419 100644 +--- a/src/flake8/plugins/pyflakes.py ++++ b/src/flake8/plugins/pyflakes.py +@@ -26,6 +26,21 @@ FLAKE8_PYFLAKES_CODES = { + "ImportStarUsage": "F405", + "ImportStarNotPermitted": "F406", + "FutureFeatureNotDefined": "F407", ++ "PercentFormatInvalidFormat": "F501", ++ "PercentFormatExpectedMapping": "F502", ++ "PercentFormatExpectedSequence": "F503", ++ "PercentFormatExtraNamedArguments": "F504", ++ "PercentFormatMissingArgument": "F505", ++ "PercentFormatMixedPositionalAndNamed": "F506", ++ "PercentFormatPositionalCountMismatch": "F507", ++ "PercentFormatStarRequiresSequence": "F508", ++ "PercentFormatUnsupportedFormatCharacter": "F509", ++ "StringDotFormatInvalidFormat": "F520", ++ "StringDotFormatExtraNamedArguments": "F521", ++ "StringDotFormatExtraPositionalArguments": "F522", ++ "StringDotFormatMissingArgument": "F523", ++ "StringDotFormatMixingAutomatic": "F524", ++ "FStringMissingPlaceholders": "F540", + "MultiValueRepeatedKeyLiteral": "F601", + "MultiValueRepeatedKeyVariable": "F602", + "TooManyExpressionsInStarredAssignment": "F621", +@@ -33,6 +48,7 @@ FLAKE8_PYFLAKES_CODES = { + "AssertTuple": "F631", + "IsLiteral": "F632", + "InvalidPrintSyntax": "F633", ++ "IfTuple": "F634", + "BreakOutsideLoop": "F701", + "ContinueOutsideLoop": "F702", + "ContinueInFinally": "F703", +-- +2.17.2 + diff --git a/community/py3-flake8/APKBUILD b/community/py3-flake8/APKBUILD index 945561e754..eb05d92cd7 100644 --- a/community/py3-flake8/APKBUILD +++ b/community/py3-flake8/APKBUILD @@ -1,9 +1,12 @@ # Contributor: Peter Bui <pnutzh4x0r@gmail.com> # Maintainer: Fabian Affolter <fabian@affolter-engineering.ch> +# NOTE: ensure compatibility with the current py3-pyflakes! (#11378) +# NOTE: 3.7.9 crashes with pyflakes 2.2.x, use patched git version as workaround pkgname=py3-flake8 _pkgname=flake8 -pkgver=3.7.9 -pkgrel=1 +pkgver=3.7.9_git20200411 +pkgrel=0 +_commit="1be8707dc71dbaed8e0b2cb72bfe83a604183a92" pkgdesc="A modular source code checker" options="!check" # Some tests fail url="https://gitlab.com/pycqa/flake8" @@ -11,8 +14,9 @@ arch="noarch" license="MIT" depends="py3-entrypoints py3-pyflakes py3-pycodestyle py3-mccabe py3-setuptools" checkdepends="py3-pytest py3-pbr py3-atomicwrites py3-attrs py3-pluggy py3-six py3-mock" -source="https://pypi.io/packages/source/f/$_pkgname/$_pkgname-$pkgver.tar.gz" -builddir="$srcdir/$_pkgname-$pkgver" +source="https://gitlab.com/pycqa/flake8/-/archive/$_commit/flake8-$_commit.tar.bz2 + 0001-Support-pyflakes-2.2.x.patch" +builddir="$srcdir/$_pkgname-$_commit" replaces="py-flake8" # Backwards compatibility provides="py-flake8=$pkgver-r$pkgrel" # Backwards compatibility @@ -32,4 +36,5 @@ package() { python3 setup.py install --prefix=/usr --root="$pkgdir" } -sha512sums="c3c753ad050d8a8f87f7c28c8a1c953ed9bd04f08b09512d9323152b4eebb57d67fbfb0f5317d629174fa12fa234e1a86d6a633dd951fff6a45330b1c4f62850 flake8-3.7.9.tar.gz" +sha512sums="744a60c352a2888775fddae9b27e0138934e72d6fc21c57769e732fcfddc59e93b61b1bc79d8fa922f44828decd4447ceed6a04688daf4641a79b44d547c9147 flake8-1be8707dc71dbaed8e0b2cb72bfe83a604183a92.tar.bz2 +a5941239449c5a2342057dae3e14f2e120303e3719af32c921d6368ad2f2ecf19ed4cd8090dea7961ceb438a90b93bcaf90decf588a1d0172dcaaae9677b5a72 0001-Support-pyflakes-2.2.x.patch" diff --git a/community/py3-pyflakes/APKBUILD b/community/py3-pyflakes/APKBUILD index 6b67c623ee..782887028f 100644 --- a/community/py3-pyflakes/APKBUILD +++ b/community/py3-pyflakes/APKBUILD @@ -1,5 +1,6 @@ # Contributor: Peter Bui <pnutzh4x0r@gmail.com> # Maintainer: Fabian Affolter <fabian@affolter-engineering.ch> +# NOTE: ensure compatibility with py3-flake8! (#11378) pkgname=py3-pyflakes _pkgname=${pkgname#py3-} pkgver=2.2.0 |