Accepting request 1102396 from home:mschreiner:branches:devel:languages:python

- Update to 2.11.0
  * Drop EOL python 3.6 / 3.7.
  * Add support for python 3.12.
  * E721: adjust handling of type comparison.
    Allowed forms are now isinstance(x, t) or type(x) is t.
  * Remove handling of python 2 <> operator.
  * W606: removed. async / await are always keywords.
  * Internal: move tests to pytest.
  * Remove handling of python 2 ur'' strings.
- Remove testsuite_fixes.patch as it's no longer required
- Replaced spec file "Source" to pull from GitHub due to this issue:
  https://github.com/PyCQA/pycodestyle/issues/1183
- Apply spec-cleaner to spec file.

OBS-URL: https://build.opensuse.org/request/show/1102396
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pycodestyle?expand=0&rev=34
This commit is contained in:
Markéta Machová 2023-08-04 14:27:30 +00:00 committed by Git OBS Bridge
parent ae379a7fa3
commit 35aeb575a9
5 changed files with 26 additions and 167 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:347187bdb476329d98f695c213d7295a846d1152ff4fe9bacb8a9590b8ee7053
size 101916

BIN
pycodestyle-2.11.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Thu Aug 3 14:59:59 UTC 2023 - Martin Schreiner <martin.schreiner@suse.com>
- Update to 2.11.0
* Drop EOL python 3.6 / 3.7.
* Add support for python 3.12.
* E721: adjust handling of type comparison.
Allowed forms are now isinstance(x, t) or type(x) is t.
* Remove handling of python 2 <> operator.
* W606: removed. async / await are always keywords.
* Internal: move tests to pytest.
* Remove handling of python 2 ur'' strings.
- Remove testsuite_fixes.patch as it's no longer required
- Replaced spec file "Source" to pull from GitHub due to this issue:
https://github.com/PyCQA/pycodestyle/issues/1183
- Apply spec-cleaner to spec file.
-------------------------------------------------------------------
Tue Jul 18 11:27:38 UTC 2023 - Ana Guerrero <ana.guerrero@suse.com>

View File

@ -16,25 +16,24 @@
#
%{?sle15_python_module_pythons}
Name: python-pycodestyle
Version: 2.10.0
Version: 2.11.0
Release: 0
Summary: Python style guide checker
License: MIT
Group: Development/Languages/Python
URL: https://pycodestyle.readthedocs.io/
Source: https://files.pythonhosted.org/packages/source/p/pycodestyle/pycodestyle-%{version}.tar.gz
Patch01: testsuite_fixes.patch
Source: https://github.com/PyCQA/pycodestyle/archive/refs/tags/%{version}.tar.gz#/pycodestyle-%{version}.tar.gz
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
Provides: python-pep8 = %{version}
Obsoletes: python-pep8 < %{version}
Requires(post): update-alternatives
Requires(postun):update-alternatives
Provides: python-pep8 = %{version}
Obsoletes: python-pep8 < %{version}
BuildArch: noarch
%{?sle15_python_module_pythons}
%python_subpackages
%description

View File

@ -1,157 +0,0 @@
Testsuite fixes to pass with python 3.11.4 and python 3.12
Fixes taken from upstream commits:
e20394e5cbd8d440c9c1868ddc25d036afcbfe45
e8d84098da10d013ee686027e174814dbe4dd908
diff -Nrua pycodestyle-2.10.0.original/pycodestyle.py pycodestyle-2.10.0/pycodestyle.py
--- pycodestyle-2.10.0.original/pycodestyle.py 2022-11-23 19:26:34.000000000 +0100
+++ pycodestyle-2.10.0/pycodestyle.py 2023-07-18 13:15:24.537262524 +0200
@@ -196,7 +196,6 @@
These options are highly recommended!
Okay: if a == 0:\n a = 1\n b = 1
- E101: if a == 0:\n a = 1\n\tb = 1
"""
indent = INDENT_REGEX.match(physical_line).group(1)
for offset, char in enumerate(indent):
@@ -802,9 +801,10 @@
(index < 2 or tokens[index - 2][1] != 'class') and
# Allow "return (a.foo for a in range(5))"
not keyword.iskeyword(prev_text) and
- # 'match' and 'case' are only soft keywords
(
sys.version_info < (3, 9) or
+ # 3.12+: type is a soft keyword but no braces after
+ prev_text == 'type' or
not keyword.issoftkeyword(prev_text)
)
):
diff -Nrua pycodestyle-2.10.0.original/testsuite/E10.py pycodestyle-2.10.0/testsuite/E10.py
--- pycodestyle-2.10.0.original/testsuite/E10.py 2022-11-23 19:26:34.000000000 +0100
+++ pycodestyle-2.10.0/testsuite/E10.py 2023-07-18 13:15:24.537262524 +0200
@@ -1,8 +1,3 @@
-#: E101 W191
-for a in 'abc':
- for b in 'xyz':
- print a # indented with 8 spaces
- print b # indented with 1 tab
#: E101 E122 W191 W191
if True:
pass
diff -Nrua pycodestyle-2.10.0.original/testsuite/E90.py pycodestyle-2.10.0/testsuite/E90.py
--- pycodestyle-2.10.0.original/testsuite/E90.py 2022-11-23 19:26:34.000000000 +0100
+++ pycodestyle-2.10.0/testsuite/E90.py 2023-07-18 13:15:24.541262682 +0200
@@ -1,6 +1,4 @@
#: E901
-}
-#: E901
= [x
#: E901 E101 W191
while True:
@@ -8,14 +6,6 @@
pass
except:
print 'Whoops'
-#: E122 E225 E251 E251
-
-# Do not crash if code is invalid
-if msg:
- errmsg = msg % progress.get(cr_dbname))
-
-def lasting(self, duration=300):
- progress = self._progress.setdefault('foo', {}
#: Okay
# Issue #119
diff -Nrua pycodestyle-2.10.0.original/testsuite/python312.py pycodestyle-2.10.0/testsuite/python312.py
--- pycodestyle-2.10.0.original/testsuite/python312.py 1970-01-01 01:00:00.000000000 +0100
+++ pycodestyle-2.10.0/testsuite/python312.py 2023-07-18 13:15:24.541262682 +0200
@@ -0,0 +1,9 @@
+#: Okay
+# https://github.com/python/cpython/issues/90432: fixed in 3.12
+def foo():
+ pas
+
+\
+
+def bar():
+ pass
diff -Nrua pycodestyle-2.10.0.original/testsuite/test_api.py pycodestyle-2.10.0/testsuite/test_api.py
--- pycodestyle-2.10.0.original/testsuite/test_api.py 2022-11-23 19:26:34.000000000 +0100
+++ pycodestyle-2.10.0/testsuite/test_api.py 2023-07-18 13:15:24.541262682 +0200
@@ -329,12 +329,18 @@
count_errors = pep8style.input_file('stdin', lines=['\x00\n'])
stdout = sys.stdout.getvalue()
- expected = "stdin:1:1: E901 ValueError"
- self.assertTrue(stdout.startswith(expected),
- msg='Output %r does not start with %r' %
- (stdout, expected))
+ if sys.version_info < (3, 11, 4):
+ expected = ["stdin:1:1: E901 ValueError: source code string cannot contain null bytes"] # noqa: E501
+ elif sys.version_info < (3, 12):
+ expected = ["stdin:1:1: E901 SyntaxError: source code string cannot contain null bytes"] # noqa: E501
+ else:
+ expected = [
+ "stdin:1:1: E901 SyntaxError: source code string cannot contain null bytes", # noqa: E501
+ "stdin:1:1: E901 TokenError: source code cannot contain null bytes", # noqa: E501
+ ]
+ self.assertEqual(stdout.splitlines(), expected)
self.assertFalse(sys.stderr)
- self.assertEqual(count_errors, 1)
+ self.assertEqual(count_errors, len(expected))
def test_styleguide_unmatched_triple_quotes(self):
pycodestyle.register_check(DummyChecker, ['Z701'])
@@ -347,35 +353,22 @@
pep8style.input_file('stdin', lines=lines)
stdout = sys.stdout.getvalue()
- expected = 'stdin:2:5: E901 TokenError: EOF in multi-line string'
- self.assertTrue(expected in stdout)
-
- def test_styleguide_continuation_line_outdented(self):
- pycodestyle.register_check(DummyChecker, ['Z701'])
- lines = [
- 'def foo():\n',
- ' pass\n',
- '\n',
- '\\\n',
- '\n',
- 'def bar():\n',
- ' pass\n',
- ]
-
- pep8style = pycodestyle.StyleGuide()
- count_errors = pep8style.input_file('stdin', lines=lines)
- self.assertEqual(count_errors, 2)
- stdout = sys.stdout.getvalue()
- expected = (
- 'stdin:6:1: '
- 'E122 continuation line missing indentation or outdented'
- )
- self.assertTrue(expected in stdout)
- expected = 'stdin:6:1: E302 expected 2 blank lines, found 1'
- self.assertTrue(expected in stdout)
-
- # TODO: runner
- # TODO: input_file
+ if sys.version_info < (3, 10):
+ expected = [
+ 'stdin:2:5: E901 TokenError: EOF in multi-line string',
+ 'stdin:2:26: E901 SyntaxError: EOF while scanning triple-quoted string literal', # noqa: E501
+ ]
+ elif sys.version_info < (3, 12):
+ expected = [
+ 'stdin:2:5: E901 TokenError: EOF in multi-line string',
+ 'stdin:2:6: E901 SyntaxError: unterminated triple-quoted string literal (detected at line 2)', # noqa: E501
+ ]
+ else:
+ expected = [
+ 'stdin:2:6: E901 SyntaxError: unterminated triple-quoted string literal (detected at line 2)', # noqa: E501
+ 'stdin:2:6: E901 TokenError: EOF in multi-line string',
+ ]
+ self.assertEqual(stdout.splitlines(), expected)
def test_styleguides_other_indent_size(self):
pycodestyle.register_check(DummyChecker, ['Z701'])