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