From 21242af3d953e88adc13f59df5a10a91d678b54e Mon Sep 17 00:00:00 2001 From: Erik Schamper <1254028+Schamper@users.noreply.github.com> Date: Tue, 4 Jun 2024 14:13:15 +0200 Subject: [PATCH] Compatibility with cstruct v4 (#19) --- dissect/executable/elf/c_elf.py | 11 +++-------- pyproject.toml | 10 ++++++++-- tox.ini | 1 + 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/dissect/executable/elf/c_elf.py b/dissect/executable/elf/c_elf.py index 45dfa3d..8e7e43b 100644 --- a/dissect/executable/elf/c_elf.py +++ b/dissect/executable/elf/c_elf.py @@ -401,14 +401,9 @@ def copy_cstruct(src_struct: cstruct) -> cstruct: return dst_struct -c_common_elf = cstruct() -c_common_elf.load(elf_def) - -c_elf_32 = copy_cstruct(c_common_elf) -c_elf_32.load(elf_32_def) - -c_elf_64 = copy_cstruct(c_common_elf) -c_elf_64.load(elf_64_def) +c_common_elf = cstruct().load(elf_def) +c_elf_32 = copy_cstruct(c_common_elf).load(elf_32_def) +c_elf_64 = copy_cstruct(c_common_elf).load(elf_64_def) PT: IntEnum = c_common_elf.PT Elf_Type: IntEnum = c_common_elf.Elf_Type diff --git a/pyproject.toml b/pyproject.toml index bc9cc12..5713f58 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,8 +25,8 @@ classifiers = [ "Topic :: Utilities", ] dependencies = [ - "dissect.cstruct>=3.0.dev,<4.0.dev", - "dissect.util>=3.0.dev,<4.0.dev", + "dissect.cstruct>=4.dev,<5", + "dissect.util>=3,<4", ] dynamic = ["version"] @@ -35,6 +35,12 @@ homepage = "https://dissect.tools" documentation = "https://docs.dissect.tools/en/latest/projects/dissect.executable" repository = "https://github.com/fox-it/dissect.executable" +[project.optional-dependencies] +dev = [ + "dissect.cstruct>=4.0.dev,<5.0.dev", + "dissect.util>=3.0.dev,<4.0.dev", +] + [tool.black] line-length = 120 diff --git a/tox.ini b/tox.ini index 67e8e8a..7bd2890 100644 --- a/tox.ini +++ b/tox.ini @@ -11,6 +11,7 @@ minversion = 4.4.3 requires = virtualenv>=20.16.6 [testenv] +extras = dev deps = pytest pytest-cov