[PATCH 1/2] gnu: python-pep8: Patch to fix test failure with Python 3.7.

  • Done
  • quality assurance status badge
Details
2 participants
  • Christopher Baines
  • Marius Bakke
Owner
unassigned
Submitted by
Christopher Baines
Severity
normal
C
C
Christopher Baines wrote on 14 Jul 2019 00:01
(address . guix-patches@gnu.org)
20190713220102.7416-1-mail@cbaines.net
Patch from the upstream repository, see

* gnu/packages/patches/python-pep8-stdlib-tokenize-compat.patch: New file.
* gnu/packages/python-xyz.scm (python-pep8)[source]: Add it.
---
.../python-pep8-stdlib-tokenize-compat.patch | 35 +++++++++++++++++++
gnu/packages/python-xyz.scm | 3 +-
2 files changed, 37 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/python-pep8-stdlib-tokenize-compat.patch

Toggle diff (57 lines)
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
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index a60e1c7e2a..ac43ef9057 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -6350,7 +6350,8 @@ applications.")
(uri (pypi-uri "pep8" version))
(sha256
(base32
- "002rkl4lsn6x2mxmf8ar00l0m8i3mzrc6pnzz77blyksmpsxa4x1"))))
+ "002rkl4lsn6x2mxmf8ar00l0m8i3mzrc6pnzz77blyksmpsxa4x1"))
+ (patches (search-patches "python-pep8-stdlib-tokenize-compat.patch"))))
(build-system python-build-system)
(home-page "https://pep8.readthedocs.org/")
(synopsis "Python style guide checker")
--
2.22.0
C
C
Christopher Baines wrote on 14 Jul 2019 00:17
Re: core-updates frozen!
(address . guix-devel@gnu.org)
87pnmdzijn.fsf@cbaines.net
I've sent a few patches to fix a couple of build issues on the
core-updates branch [1][2].

-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl0qWFxfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XcgNQ/7BDiCSo+ztV1HqWrjoXJFfNBHn3SDrI+JZHZQoq8A5UdgW/p5NO8B5Xec
RyGUj6z1I/auyWSrp3W5mWhaQ9xwvsF6wa8bhh/RP9RyCun/h7U2jgghYHHXXLKZ
SAs9CF47eDbYYLJBqvp59HNaLjv5uYIUn0RSkfDV9+KRMwEfedENdgEpnZtg8mtD
viYHQoE7j26nDHIdIpnAUI93iu/CTK/s2gO2Vk2AGlBJoqzX5/G4BeWbtdv9QgtO
zmJYZYM/84HpHEs2WOttbSnbG9Qvj1vb4eQY0S3TdXJ6c3FDpPGYvlWH74eoFBUX
ZjyKS5XbUfFDKXXtA/gTrbECd+bER6UCpbRrOXdZlZlNuwUFMXG5FGO2iFDTALjq
WQGdlrNFwcKu3HFyIibDobXby+fsxtrPsLzyIDN9UsAUthFkzB4g9o6AUwrgNJPJ
Y+aiFRnbKdeaauyaz4cMtd7Uhiy8muH+aZURCP8xSNjGQWImcglSfgoigWSJDoa2
kCNjnr44Zd+h+kfHALrOU5S9CfEWIHrxob9JlWVQAT8JHM+Dg1FEEhDPBDE1YZgx
WFNhaTQPe4OJ0kLaYX3RB/sJ2InjvSAu6TZQZjK0ipRNxC3Z1gNyHF5m4qiLbhhV
v54DrBpVsrchIRTPUl8xIeBqZLQ/0EJ1CJEYB/22NaiLPACb0KE=
=AIC+
-----END PGP SIGNATURE-----

M
M
Marius Bakke wrote on 14 Jul 2019 00:56
Re: [bug#36643] [PATCH 1/2] gnu: python-pep8: Patch to fix test failure with Python 3.7.
87k1cllf1y.fsf@devup.no
Christopher Baines <mail@cbaines.net> writes:

Toggle quote (6 lines)
> 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.

LGTM, thanks!
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl0qYYkACgkQoqBt8qM6
VPo8tQf8Cw6u83GRYfJyWSLXSB04yBxabIgenvvklJC7prbcWgbpFAFZHeVDalQW
PEgwSBj1cPs/EAEo0Df+KoEQznchhMgEjemRufmKQxLhyC7EPft8VGZ9hJtZRZNL
SCKp6xVAyodFdb5QZ92Iz5E0YnaOYoh+4xE08KJOnlxhPMCWnOFQl98B5eQ1YL6/
N5+XKNeGPpxm4JM6HUNTJhdWWxpYxV2vVmXfcUCKJ8g8b1fk70ZYzN6zQW+voxKz
JNFXWCL4wt8m8PYZV7XZcEdoL4XL9UT9k3wUcUyz5xXL4UvftXZXuuo9Ll3TonhN
yB7SDC1PBVgiU9znHnepgKCHBYM3VQ==
=Egmo
-----END PGP SIGNATURE-----

C
C
Christopher Baines wrote on 14 Jul 2019 10:10
(name . Marius Bakke)(address . mbakke@fastmail.com)(address . 36643-done@debbugs.gnu.org)
87v9w53ukw.fsf@cbaines.net
Marius Bakke <mbakke@fastmail.com> writes:

Toggle quote (10 lines)
> Christopher Baines <mail@cbaines.net> writes:
>
>> 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.
>
> LGTM, thanks!

Great, I've pushed this now.
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl0q429fFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XeZkw//c0y5aZRpN1gRn6V3H9N36INHDwmMDUqf821otMZ6nIVT3tw5hrRghxMo
P6NJMtEVX60Ele6adjK4KHc0DnxUl3AG/hi0yHxPAriFpsVC87KvWgQP8H2K9KoR
WXRBEOz5Mi5dNMiWql8O6gyrRAJNgl1BlOhUAOPKq8oXt2cJjOcyaNXgI7QHWI1a
GYWy4ghz5JMhflt1eGMrdX6FZWZWcQTQC6sltXbKhEf/ZRrvLtMVfCypK3s9RKc8
K09GfUL+vAmpsj8GbQwgY0TWqiq7qsM9F3rN8WFIjUd9OOzocm3od0zEbPBLUvZh
bUyMtpoMy3yQ6SAb8YMLdHsaJIvsCFT4rxl3H3yueiFERpnBcCi/DP04t0PjBU9o
cwLlif0v+ulMWii9z6gIEii0j0eVYVl9uahMighc9+vop++SxX3Du0P+novbUmpI
ggpHAjKAvkAsi1NL299QxCu5X7VW352wXhWh7DkpfDBsgGLhmpcln8GYYXBfZEcm
0ulyuXSTqcOWgtuh0zHzpMY38Llmn3MZATBhFJT2uZv3z4lu2p7Q0qZyHbiQL5BB
LmuM12Hrxdhbuoq3cKY0Gc56HMgAMrzmu/mrJqALkqYNDq5sKMf/KRjpCJmxpHM+
DdIjDhDj55AviAgxtVb/Lyf5NEnz3cFWcafcW/SpObN4l2OhgAU=
=NJIq
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 36643@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 36643
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch