diff options
author | Christopher Baines <mail@cbaines.net> | 2019-07-13 22:51:48 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-07-14 09:03:19 +0100 |
commit | 2be878d8e54057980121e4c659ca48317b79970e (patch) | |
tree | 1f3374b7304a08b05eafdc8f1c1ac40d8376236d /gnu/packages/patches | |
parent | 6005440d988b331db5ea11a475973cee9a5acce6 (diff) | |
download | guix-2be878d8e54057980121e4c659ca48317b79970e.tar guix-2be878d8e54057980121e4c659ca48317b79970e.tar.gz |
gnu: python-pep8: Patch to fix test failure with Python 3.7.
Patch from the upstream repository, see
https://github.com/PyCQA/pycodestyle/issues/786 for more details.
* gnu/packages/patches/python-pep8-stdlib-tokenize-compat.patch: New file.
* gnu/packages/python-xyz.scm (python-pep8)[source]: Add it.
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r-- | gnu/packages/patches/python-pep8-stdlib-tokenize-compat.patch | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/gnu/packages/patches/python-pep8-stdlib-tokenize-compat.patch b/gnu/packages/patches/python-pep8-stdlib-tokenize-compat.patch new file mode 100644 index 0000000000..f11d8f7be8 --- /dev/null +++ b/gnu/packages/patches/python-pep8-stdlib-tokenize-compat.patch @@ -0,0 +1,35 @@ +From 397463014fda3cdefe8d6c9d117ae16d878dc494 Mon Sep 17 00:00:00 2001 +From: Michael Hudson-Doyle <michael.hudson@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 |