Commit b12f7046 authored by Gordon Ball's avatar Gordon Ball
Browse files

Use pyflakes3 instead of (python 2) pyflakes

python-apt currently uses (python 3) pycodestyle and (python 2) pyflakes
for code quality checks. It is one of the last users of pyflakes and
dropping this dependency should allow further removals of python 2
packages.

This necessitated two small fixes where python2-only builtins are
referred to (even when protected by version guards) to prevent pyflakes3
from identifying them as errors.
parent afed4b29
......@@ -41,10 +41,11 @@ io # pyflakes
__all__ = ['AcquireProgress', 'CdromProgress', 'OpProgress']
if sys.version_info.major < 3:
input = raw_input # type: ignore
else:
if sys.version_info.major >= 3:
raw_input = input # pyflakes
long = int
else:
input = raw_input
def _(msg):
......
......@@ -23,7 +23,7 @@ Build-Depends: apt (>= 1.0.9.4),
gnupg,
dirmngr | gnupg (<< 2),
pycodestyle,
pyflakes
pyflakes3
Vcs-Git: https://salsa.debian.org/apt-team/python-apt.git
Vcs-Browser: https://salsa.debian.org/apt-team/python-apt
......
Tests: run-tests
Depends: @, apt-utils, python-all, python3-all, fakeroot, intltool, pycodestyle, pyflakes, gnupg, dirmngr | gnupg (<< 2)
Depends: @, apt-utils, python-all, python3-all, fakeroot, intltool, pycodestyle, pyflakes3, gnupg, dirmngr | gnupg (<< 2)
......@@ -90,10 +90,10 @@ class TestHashes(testcommon.TestCase):
self.assertRaises(TypeError, apt_pkg.sha1sum, "D")
self.assertRaises(TypeError, apt_pkg.sha256sum, "D")
else:
self.assertRaises(TypeError, apt_pkg.Hashes, unicode())
self.assertRaises(TypeError, apt_pkg.md5sum, unicode())
self.assertRaises(TypeError, apt_pkg.sha1sum, unicode())
self.assertRaises(TypeError, apt_pkg.sha256sum, unicode())
self.assertRaises(TypeError, apt_pkg.Hashes, u"")
self.assertRaises(TypeError, apt_pkg.md5sum, u"")
self.assertRaises(TypeError, apt_pkg.sha1sum, u"")
self.assertRaises(TypeError, apt_pkg.sha256sum, u"")
class TestHashString(testcommon.TestCase):
......
......@@ -31,7 +31,7 @@ class TestPyflakesClean(testcommon.TestCase):
return files
def test_pyflakes_clean(self):
cmd = ["pyflakes"] + self.get_py_files(self.TOPLEVEL)
cmd = ["pyflakes3"] + self.get_py_files(self.TOPLEVEL)
res = subprocess.call(cmd)
if res != 0:
self.fail("pyflakes failed with: %s" % res)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment