From: Peter Lemenkov Date: Mon, 30 Jul 2018 15:46:19 +0300 Subject: [PATCH] Don't use byte strings Signed-off-by: Peter Lemenkov diff --git a/erlang-find-requires.py b/erlang-find-requires.py index 1aa3d98..ca32d1f 100755 --- a/erlang-find-requires.py +++ b/erlang-find-requires.py @@ -190,7 +190,7 @@ def check_for_mfa(Path, Dict, MFA): def inspect_so_library(library, export_name, dependency_name): with open(library, 'rb') as f: elffile = ELFFile(f) - dynsym = elffile.get_section_by_name(b'.dynsym') + dynsym = elffile.get_section_by_name('.dynsym') for sym in dynsym.iter_symbols(): if sym.name == export_name: ts = rpm.TransactionSet() @@ -288,8 +288,8 @@ if __name__ == "__main__": Ret = inspect_beam_file(ISA, filename) elif filename.endswith(".so"): - Ret += [inspect_so_library(filename, b'nif_init', 'erlang(erl_nif_version)')] - Ret += [inspect_so_library(filename, b'driver_init', 'erlang(erl_drv_version)')] + Ret += [inspect_so_library(filename, 'nif_init', 'erlang(erl_nif_version)')] + Ret += [inspect_so_library(filename, 'driver_init', 'erlang(erl_drv_version)')] elif filename.endswith(".app"): # TODO we don't know what to do with *.app files yet diff --git a/testing.py b/testing.py index 2fe2f22..4a5c263 100644 --- a/testing.py +++ b/testing.py @@ -19,12 +19,12 @@ class TestAllMethods(unittest.TestCase): def test_inspect_so_library_nif(self): # This test requires erlang-crypto RPM package installed filepath = glob.glob("/usr/lib*/erlang/lib/crypto-*/priv/lib/crypto.so")[0] - self.assertEqual(M.inspect_so_library(filepath, b'nif_init', 'erlang(erl_nif_version)'), ErlNifDep) + self.assertEqual(M.inspect_so_library(filepath, 'nif_init', 'erlang(erl_nif_version)'), ErlNifDep) def test_inspect_so_library_drv(self): # This test requires erlang-erlsyslog RPM package installed filepath = glob.glob("/usr/lib*/erlang/lib/erlsyslog-*/priv/erlsyslog_drv.so")[0] - self.assertEqual(M.inspect_so_library(filepath, b'driver_init', 'erlang(erl_drv_version)'), ErlDrvDep) + self.assertEqual(M.inspect_so_library(filepath, 'driver_init', 'erlang(erl_drv_version)'), ErlDrvDep) def test_inspect_beam_file_arch(self): Deps = ['erlang-erts(x86-64)', 'erlang-kernel(x86-64)', 'erlang-stdlib(x86-64)']