[packages/python-pep8] - added nestedset,tokenize patches (fixes for py3.7+ backported from pycodestyle) - added deprecatio
qboosh
qboosh at pld-linux.org
Sun Jan 12 20:55:24 CET 2020
commit 95031b571d110d0810aeab52215307d14509df4f
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sun Jan 12 20:55:27 2020 +0100
- added nestedset,tokenize patches (fixes for py3.7+ backported from pycodestyle)
- added deprecation warnings to descriptions
- release 3
python-pep8-nestedset.patch | 11 +++++++++++
python-pep8-tokenize.patch | 35 +++++++++++++++++++++++++++++++++++
python-pep8.spec | 26 +++++++++++++++++++++++---
3 files changed, 69 insertions(+), 3 deletions(-)
---
diff --git a/python-pep8.spec b/python-pep8.spec
index 1664db6..b1cb71a 100644
--- a/python-pep8.spec
+++ b/python-pep8.spec
@@ -10,12 +10,14 @@ Summary: Python style guide checker
Summary(pl.UTF-8): Sprawdzanie zgodności z poradnikiem stylu kodowania w Pythonie
Name: python-%{module}
Version: 1.7.1
-Release: 2
+Release: 3
License: MIT
Group: Libraries/Python
#Source0Download: https://pypi.org/simple/pep8/
Source0: https://files.pythonhosted.org/packages/source/p/pep8/%{module}-%{version}.tar.gz
# Source0-md5: 603821d06db945c71d811b5a8d78423c
+Patch0: %{name}-nestedset.patch
+Patch1: %{name}-tokenize.patch
URL: https://pypi.org/project/pep8/
BuildRequires: rpm-pythonprov
BuildRequires: rpmbuild(macros) >= 1.714
@@ -34,10 +36,14 @@ BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
pep8 is a tool to check your Python code against some of the style
conventions in PEP 8.
+Note: it's deprecated in favour on pycodestyle.
+
%description -l pl.UTF-8
pep8 to narzędzie do sprawdzania kodu w Pythonie względem niektórych
konwencji stylistycznych opisanych w PEP 8.
+Uwaga: to narzędzie jest przestarzałe, nowszą wersją jest pycodestyle.
+
%package -n python3-%{module}
Summary: Python style guide checker
Summary(pl.UTF-8): Sprawdzanie zgodności z poradnikiem stylu kodowania w Pythonie
@@ -48,10 +54,14 @@ Requires: python3-modules
pep8 is a tool to check your Python code against some of the style
conventions in PEP 8.
+Note: it's deprecated in favour on pycodestyle.
+
%description -n python3-%{module} -l pl.UTF-8
pep8 to narzędzie do sprawdzania kodu w Pythonie względem niektórych
konwencji stylistycznych opisanych w PEP 8.
+Uwaga: to narzędzie jest przestarzałe, nowszą wersją jest pycodestyle.
+
%package apidocs
Summary: API documentation for pep8 module
Summary(pl.UTF-8): Dokumentacja API modułu pep8
@@ -65,17 +75,27 @@ Dokumentacja API modułu pep8.
%prep
%setup -q -n %{module}-%{version}
+%patch0 -p1
+%patch1 -p1
%build
# pep8 issues deprecance warning, which causes some tests to fail
export PYTHONWARNINGS=ignore
%if %{with python2}
-%py_build %{?with_tests:test}
+%py_build
+
+%if %{with tests}
+%{__python} -m testsuite.test_all
+%endif
%endif
%if %{with python3}
-%py3_build %{?with_tests:test}
+%py3_build
+
+%if %{with tests}
+%{__python3} -m testsuite.test_all
+%endif
%endif
%if %{with doc}
diff --git a/python-pep8-nestedset.patch b/python-pep8-nestedset.patch
new file mode 100644
index 0000000..6baabc5
--- /dev/null
+++ b/python-pep8-nestedset.patch
@@ -0,0 +1,11 @@
+--- pep8-1.7.1/pep8.py.orig 2017-10-24 16:38:06.000000000 +0200
++++ pep8-1.7.1/pep8.py 2020-01-12 20:35:19.209557017 +0100
+@@ -107,7 +107,7 @@
+ RERAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*,.*,\s*\w+\s*$')
+ ERRORCODE_REGEX = re.compile(r'\b[A-Z]\d{3}\b')
+ DOCSTRING_REGEX = re.compile(r'u?r?["\']')
+-EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
++EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[\[({] | [\]}),;:]')
+ WHITESPACE_AFTER_COMMA_REGEX = re.compile(r'[,;:]\s*(?: |\t)')
+ COMPARE_SINGLETON_REGEX = re.compile(r'(\bNone|\bFalse|\bTrue)?\s*([=!]=)'
+ r'\s*(?(1)|(None|False|True))\b')
diff --git a/python-pep8-tokenize.patch b/python-pep8-tokenize.patch
new file mode 100644
index 0000000..f11d8f7
--- /dev/null
+++ b/python-pep8-tokenize.patch
@@ -0,0 +1,35 @@
+From 397463014fda3cdefe8d6c9d117ae16d878dc494 Mon Sep 17 00:00:00 2001
+From: Michael Hudson-Doyle <michael.hudson at canonical.com>
+Date: Tue, 25 Sep 2018 14:58:57 +1200
+Subject: [PATCH] Keep compability with stdlib tokenize.py changes
+
+https://github.com/python/cpython/commit/c4ef4896eac86a6759901c8546e26de4695a1389
+is not yet part of any release of Python but has been backported to all
+versions in Git (includeing 2.7!). It causes the tokenize.py module to
+emit a synthetic NEWLINE token for files that do not in fact end with a
+newline, which confuses pycodestyle's checks for blank lines at the end
+of a file. Fortunately the synthetic NEWLINE tokens are easy to detect
+(the token text is "").
+
+Fixes #786
+---
+ pycodestyle.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pycodestyle.py b/pycodestyle.py
+index 0d725d27..fbc3dca3 100755
+--- a/pep8.py
++++ b/pep8.py
+@@ -258,10 +258,10 @@ def trailing_blank_lines(physical_line, lines, line_number, total_lines):
+ """
+ if line_number == total_lines:
+ stripped_last_line = physical_line.rstrip()
+- if not stripped_last_line:
++ if physical_line and not stripped_last_line:
+ return 0, "W391 blank line at end of file"
+ if stripped_last_line == physical_line:
+- return len(physical_line), "W292 no newline at end of file"
++ return len(lines[-1]), "W292 no newline at end of file"
+
+
+ @register_check
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-pep8.git/commitdiff/95031b571d110d0810aeab52215307d14509df4f
More information about the pld-cvs-commit
mailing list