summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Talbert <swt@techie.net>2022-02-19 16:29:27 -0500
committerScott Talbert <swt@techie.net>2022-02-19 16:29:27 -0500
commit7b048daeb2d65dce2419dd4103903ac0d790ce34 (patch)
tree81ce6346eca31cd3c14b1209288e5cb92ae0db57
parent194a069a0a4867ebe11fe31e03eb35e8c99e16af (diff)
Support python3-flake8 >= 4.x
-rw-r--r--debian/changelog1
-rw-r--r--debian/patches/fix-flake8-4.x-support.patch94
-rw-r--r--debian/patches/series2
3 files changed, 97 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 588b8bb..05cdda7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,7 @@ python-pytest-flake8 (1.0.6-4) UNRELEASED; urgency=medium
[ Scott Talbert ]
* Enable unittests at build time
+ * Support python3-flake8 >= 4.x
-- Debian Janitor <janitor@jelmer.uk> Wed, 25 Aug 2021 18:01:32 -0000
diff --git a/debian/patches/fix-flake8-4.x-support.patch b/debian/patches/fix-flake8-4.x-support.patch
new file mode 100644
index 0000000..b692d55
--- /dev/null
+++ b/debian/patches/fix-flake8-4.x-support.patch
@@ -0,0 +1,94 @@
+From eda4ef74c0f25b856fe282742ea206b21e94c24c Mon Sep 17 00:00:00 2001
+From: Erik Kemperman <erikkemperman@gmail.com>
+Date: Sun, 17 Oct 2021 00:41:51 +0200
+Subject: [PATCH] Remove Python 2 support and dependency on py, fixes #81
+
+---
+ pytest_flake8.py | 29 ++++++++++++++++++-----------
+ setup.py | 6 +++---
+ tox.ini | 2 +-
+ 3 files changed, 22 insertions(+), 15 deletions(-)
+
+diff --git a/pytest_flake8.py b/pytest_flake8.py
+index 1e45d8f..5774714 100644
+--- a/pytest_flake8.py
++++ b/pytest_flake8.py
+@@ -2,12 +2,12 @@
+
+ import os
+ import re
++from contextlib import redirect_stdout, redirect_stderr
++from io import BytesIO, TextIOWrapper
+
+ from flake8.main import application
+ from flake8.options import config
+
+-import py
+-
+ import pytest
+
+ __version__ = '0.6'
+@@ -116,15 +116,22 @@ def setup(self):
+ pytest.skip("file(s) previously passed FLAKE8 checks")
+
+ def runtest(self):
+- call = py.io.StdCapture.call
+- found_errors, out, err = call(
+- check_file,
+- self.fspath,
+- self.flake8ignore,
+- self.maxlength,
+- self.maxcomplexity,
+- self.showshource,
+- self.statistics)
++ with BytesIO() as bo, TextIOWrapper(bo, encoding='utf-8') as to, \
++ BytesIO() as be, TextIOWrapper(be, encoding='utf-8') as te, \
++ redirect_stdout(to), redirect_stderr(te):
++ found_errors = check_file(
++ self.fspath,
++ self.flake8ignore,
++ self.maxlength,
++ self.maxcomplexity,
++ self.showshource,
++ self.statistics
++ )
++ to.flush()
++ te.flush()
++ out = bo.getvalue().decode('utf-8')
++ err = be.getvalue().decode('utf-8')
++
+ if found_errors:
+ raise Flake8Error(out, err)
+ # update mtime only if test passed
+diff --git a/setup.py b/setup.py
+index 50e91c9..1dfdf3c 100644
+--- a/setup.py
++++ b/setup.py
+@@ -14,13 +14,13 @@
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: BSD License",
+ "Programming Language :: Python",
+- "Programming Language :: Python :: 2",
+- "Programming Language :: Python :: 2.7",
+ "Programming Language :: Python :: 3",
+- "Programming Language :: Python :: 3.4",
+ "Programming Language :: Python :: 3.5",
+ "Programming Language :: Python :: 3.6",
+ "Programming Language :: Python :: 3.7",
++ "Programming Language :: Python :: 3.8",
++ "Programming Language :: Python :: 3.9",
++ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: Implementation :: CPython",
+ "Programming Language :: Python :: Implementation :: PyPy",
+ "Topic :: Software Development",
+diff --git a/tox.ini b/tox.ini
+index 12da49e..343cfdd 100644
+--- a/tox.ini
++++ b/tox.ini
+@@ -1,5 +1,5 @@
+ [tox]
+-envlist=py27,py36-pytesttrunk,py36-xdist,py34,py35,py36,py37,py38,pypy,pypy3
++envlist=py36-pytesttrunk,py36-xdist,py35,py36,py37,py38,py39,py310,pypy,pypy3
+
+ [testenv]
+ deps=pytest
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..928676f
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,2 @@
+# From https://github.com/tholo/pytest-flake8/pull/82
+fix-flake8-4.x-support.patch