[arch-projects] [namcap] [patch] Python 3.7 cleanups
This patch series cleans up unused imports and resolves the deprecation warning showns with Python 3.7
Remove unused imports tree-wide, which also resolves the deprecationwarning for the imp module import which is now printed to stdout. Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl> --- Namcap/rules/anyelf.py | 4 ++-- Namcap/rules/elffiles.py | 4 +--- Namcap/rules/extravars.py | 1 - Namcap/rules/fhs.py | 1 - Namcap/rules/javafiles.py | 1 - Namcap/rules/mimefiles.py | 1 - Namcap/rules/shebangdepends.py | 1 - Namcap/rules/sodepends.py | 1 - Namcap/rules/unusedsodepends.py | 2 +- Namcap/tests/pkgbuild/test_carch.py | 1 - Namcap/util.py | 1 - namcap.py | 5 ----- 12 files changed, 4 insertions(+), 19 deletions(-) diff --git a/Namcap/rules/anyelf.py b/Namcap/rules/anyelf.py index 1e497e4..27f394c 100644 --- a/Namcap/rules/anyelf.py +++ b/Namcap/rules/anyelf.py @@ -21,8 +21,8 @@ Check for ELF files to see if a package should be 'any' architecture """ -import os, re -from Namcap.util import is_elf, is_static, clean_filename +import re +from Namcap.util import is_elf, is_static from Namcap.ruleclass import * class package(TarballRule): diff --git a/Namcap/rules/elffiles.py b/Namcap/rules/elffiles.py index 431a04d..d707a58 100644 --- a/Namcap/rules/elffiles.py +++ b/Namcap/rules/elffiles.py @@ -18,13 +18,11 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -import os - from elftools.elf.elffile import ELFFile from elftools.elf.dynamic import DynamicSection from elftools.elf.sections import SymbolTableSection -from Namcap.util import is_elf, clean_filename +from Namcap.util import is_elf from Namcap.ruleclass import * # Valid directories for ELF files diff --git a/Namcap/rules/extravars.py b/Namcap/rules/extravars.py index df0c0bf..89a438f 100644 --- a/Namcap/rules/extravars.py +++ b/Namcap/rules/extravars.py @@ -17,7 +17,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -import re from itertools import product from Namcap.ruleclass import * diff --git a/Namcap/rules/fhs.py b/Namcap/rules/fhs.py index 6a40ca4..9213da0 100644 --- a/Namcap/rules/fhs.py +++ b/Namcap/rules/fhs.py @@ -18,7 +18,6 @@ # import os, re -import tarfile from Namcap.ruleclass import * class FHSRule(TarballRule): diff --git a/Namcap/rules/javafiles.py b/Namcap/rules/javafiles.py index 40ff856..50413e4 100644 --- a/Namcap/rules/javafiles.py +++ b/Namcap/rules/javafiles.py @@ -18,7 +18,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -import os from Namcap.ruleclass import * from Namcap.util import is_java diff --git a/Namcap/rules/mimefiles.py b/Namcap/rules/mimefiles.py index 4825867..f9d56f4 100644 --- a/Namcap/rules/mimefiles.py +++ b/Namcap/rules/mimefiles.py @@ -18,7 +18,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -import os from Namcap.ruleclass import * class MimeDesktopRule(TarballRule): diff --git a/Namcap/rules/shebangdepends.py b/Namcap/rules/shebangdepends.py index 7d83ff4..07896df 100644 --- a/Namcap/rules/shebangdepends.py +++ b/Namcap/rules/shebangdepends.py @@ -21,7 +21,6 @@ """Checks dependencies on programs specified in shebangs.""" -import os import shutil import Namcap.package from Namcap.util import is_script, script_type diff --git a/Namcap/rules/sodepends.py b/Namcap/rules/sodepends.py index bce3a40..2f061bb 100644 --- a/Namcap/rules/sodepends.py +++ b/Namcap/rules/sodepends.py @@ -30,7 +30,6 @@ from Namcap.ruleclass import * from Namcap.util import is_elf from Namcap.rules.rpath import get_rpaths -from elftools.elf.enums import ENUM_D_TAG from elftools.elf.elffile import ELFFile from elftools.elf.dynamic import DynamicSection diff --git a/Namcap/rules/unusedsodepends.py b/Namcap/rules/unusedsodepends.py index abfb3ba..4b148d9 100644 --- a/Namcap/rules/unusedsodepends.py +++ b/Namcap/rules/unusedsodepends.py @@ -20,7 +20,7 @@ import os, subprocess, re import tempfile -from Namcap.util import is_elf, clean_filename +from Namcap.util import is_elf from Namcap.ruleclass import * libre = re.compile('^\t(/.*)') diff --git a/Namcap/tests/pkgbuild/test_carch.py b/Namcap/tests/pkgbuild/test_carch.py index 2d95b81..728cbd2 100644 --- a/Namcap/tests/pkgbuild/test_carch.py +++ b/Namcap/tests/pkgbuild/test_carch.py @@ -19,7 +19,6 @@ # USA # -import unittest from Namcap.tests.pkgbuild_test import PkgbuildTest import Namcap.rules.carch as module diff --git a/Namcap/util.py b/Namcap/util.py index f8d38dd..68e3878 100644 --- a/Namcap/util.py +++ b/Namcap/util.py @@ -17,7 +17,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -import os import re def _file_has_magic(fileobj, magic_bytes): diff --git a/namcap.py b/namcap.py index b62a2fa..21f83f2 100755 --- a/namcap.py +++ b/namcap.py @@ -20,14 +20,9 @@ # import getopt -import imp import os -import re -import shutil -import string import sys import tarfile -import types import Namcap.depends import Namcap.tags -- 2.18.0
By removing the unused imports for clean_filename this function is now unused. --- Namcap/util.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/Namcap/util.py b/Namcap/util.py index 68e3878..ecf8b44 100644 --- a/Namcap/util.py +++ b/Namcap/util.py @@ -60,6 +60,4 @@ def script_type(fileobj): name = cmd[1] return name -clean_filename = lambda s: re.search(r"/tmp/namcap\.[0-9]*/(.*)", s).group(1) - # vim: set ts=4 sw=4 noet: -- 2.18.0
--- Namcap/tests/package/test_sodepends.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Namcap/tests/package/test_sodepends.py b/Namcap/tests/package/test_sodepends.py index 3a3d7b6..4188c35 100644 --- a/Namcap/tests/package/test_sodepends.py +++ b/Namcap/tests/package/test_sodepends.py @@ -56,13 +56,13 @@ package() { ) self.assertEqual(pkg.detected_deps['pacman'], [ ('libraries-needed %s %s', - (str(['usr/lib/libalpm.so.10']), str(["usr/bin/main"])) + (str(['usr/lib/libalpm.so.11']), str(["usr/bin/main"])) )] ) e, w, i = Namcap.depends.analyze_depends(pkg) self.assertEqual(e, [ ('dependency-detected-not-included %s (%s)', - ('pacman', "libraries ['usr/lib/libalpm.so.10'] needed in files ['usr/bin/main']")) + ('pacman', "libraries ['usr/lib/libalpm.so.11'] needed in files ['usr/bin/main']")) ]) self.assertEqual(w, []) -- 2.18.0
Duplicate of https://lists.archlinux.org/pipermail/arch-projects/2018-July/004948.html And thus equally wrong. -- Eli Schwartz Bug Wrangler and Trusted User
participants (2)
-
Eli Schwartz
-
Jelle van der Waa