From e1dc1ec3965107dad2fbfc0b063aad2e6a79f4f2 Mon Sep 17 00:00:00 2001 From: Tomer Saban Date: Mon, 3 Oct 2022 15:14:21 +0300 Subject: [PATCH 1/6] Added ELFERROR --- granulate_utils/linux/elf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/granulate_utils/linux/elf.py b/granulate_utils/linux/elf.py index c48f3c6b..4acd50b4 100644 --- a/granulate_utils/linux/elf.py +++ b/granulate_utils/linux/elf.py @@ -6,7 +6,7 @@ import hashlib from typing import Optional, cast -from elftools.elf.elffile import ELFFile # type: ignore +from elftools.elf.elffile import ELFFile, ELFError # type: ignore from elftools.elf.sections import NoteSection # type: ignore From 58762fb6a31a7cf80e845294dded7b729736c9c9 Mon Sep 17 00:00:00 2001 From: Tomer Saban Date: Mon, 3 Oct 2022 15:20:53 +0300 Subject: [PATCH 2/6] add explicit export --- granulate_utils/linux/elf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/granulate_utils/linux/elf.py b/granulate_utils/linux/elf.py index 4acd50b4..87f1ba1d 100644 --- a/granulate_utils/linux/elf.py +++ b/granulate_utils/linux/elf.py @@ -87,3 +87,5 @@ def is_statically_linked(path: str) -> bool: if segment.header.p_type == "PT_DYNAMIC": return False return True + +__all__ = ["ELFError"] From 49c920171d57d6feba4f69ea56ae11ed7a7c6465 Mon Sep 17 00:00:00 2001 From: Tomer Saban Date: Mon, 3 Oct 2022 15:25:47 +0300 Subject: [PATCH 3/6] lint --- granulate_utils/linux/elf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/granulate_utils/linux/elf.py b/granulate_utils/linux/elf.py index 87f1ba1d..38e4e371 100644 --- a/granulate_utils/linux/elf.py +++ b/granulate_utils/linux/elf.py @@ -6,7 +6,7 @@ import hashlib from typing import Optional, cast -from elftools.elf.elffile import ELFFile, ELFError # type: ignore +from elftools.elf.elffile import ELFError, ELFFile # type: ignore from elftools.elf.sections import NoteSection # type: ignore From 33457ab8863a9118d8769a0dac29408cfa83e8fc Mon Sep 17 00:00:00 2001 From: Tomer Saban Date: Mon, 3 Oct 2022 15:28:46 +0300 Subject: [PATCH 4/6] lints --- granulate_utils/linux/elf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/granulate_utils/linux/elf.py b/granulate_utils/linux/elf.py index 38e4e371..2617df77 100644 --- a/granulate_utils/linux/elf.py +++ b/granulate_utils/linux/elf.py @@ -88,4 +88,5 @@ def is_statically_linked(path: str) -> bool: return False return True + __all__ = ["ELFError"] From 252aa6fa27255fe4d41dac22248de7c7527f0ad1 Mon Sep 17 00:00:00 2001 From: Tomer Saban Date: Mon, 3 Oct 2022 15:38:55 +0300 Subject: [PATCH 5/6] fix --- granulate_utils/linux/elf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/granulate_utils/linux/elf.py b/granulate_utils/linux/elf.py index 2617df77..634df6d3 100644 --- a/granulate_utils/linux/elf.py +++ b/granulate_utils/linux/elf.py @@ -10,6 +10,9 @@ from elftools.elf.sections import NoteSection # type: ignore +__all__ = ["ELFError"] + + def get_elf_arch(path: str) -> str: """ Gets the file architecture embedded in the ELF file section @@ -87,6 +90,3 @@ def is_statically_linked(path: str) -> bool: if segment.header.p_type == "PT_DYNAMIC": return False return True - - -__all__ = ["ELFError"] From fefdd01e677a279840769de4e5b82c8d8877c700 Mon Sep 17 00:00:00 2001 From: Tomer Saban Date: Mon, 3 Oct 2022 15:48:04 +0300 Subject: [PATCH 6/6] Added import to solve an issue with the environment * Tests fail on python3.7 because of a problem with the importlib_metadata package. The issue was fixed using the workaround suggsted here: https://github.com/python/importlib_metadata/issues/406#issuecomment-1264682770 --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index c88bc431..23182dff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,3 +7,4 @@ dataclasses~=0.8; python_version < '3.7' typing-extensions>=4.1.0 pyelftools~=0.28 packaging~=21.2 +importlib_metadata~=4.8