From f5115f75dca4ff2519adf1421b6eff213bb1aadd Mon Sep 17 00:00:00 2001 From: Schamper <1254028+Schamper@users.noreply.github.com> Date: Fri, 24 May 2024 17:00:12 +0200 Subject: [PATCH] Compatibility with cstruct v4 --- dissect/fat/c_exfat.py | 7 +++---- dissect/fat/c_fat.py | 7 +++---- pyproject.toml | 4 ++-- tox.ini | 7 +++++++ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/dissect/fat/c_exfat.py b/dissect/fat/c_exfat.py index 9ec94e0..1cda56e 100644 --- a/dissect/fat/c_exfat.py +++ b/dissect/fat/c_exfat.py @@ -1,6 +1,6 @@ -from dissect import cstruct +from dissect.cstruct import cstruct -c_exfat_def = """ +exfat_def = """ enum entry_types : uint8 { allocation_bitmap = 0x81, upcase_table = 0x82, @@ -139,8 +139,7 @@ """ # default endianess is LE so we keep it that way. -c_exfat = cstruct.cstruct() -c_exfat.load(c_exfat_def) +c_exfat = cstruct().load(exfat_def) EOC = 0xFFFFFFFF # indicates end of cluster chain FID = 0xFFFFFFF8 # indicates start of FAT diff --git a/dissect/fat/c_fat.py b/dissect/fat/c_fat.py index f031b55..74eaeb0 100644 --- a/dissect/fat/c_fat.py +++ b/dissect/fat/c_fat.py @@ -1,7 +1,7 @@ -from dissect import cstruct +from dissect.cstruct import cstruct # https://ogris.de/fatrepair/fat.c -c_fat_def = """ +fat_def = """ #define ATTR_READ_ONLY 0x01 #define ATTR_HIDDEN 0x02 #define ATTR_SYSTEM 0x04 @@ -90,8 +90,7 @@ }; """ # noqa: E501 -c_fat = cstruct.cstruct() -c_fat.load(c_fat_def) +c_fat = cstruct().load(fat_def) Fattype = c_fat.Fattype diff --git a/pyproject.toml b/pyproject.toml index 376f006..57ef759 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>3,<5", + "dissect.util>2,<4", ] dynamic = ["version"] diff --git a/tox.ini b/tox.ini index 67e8e8a..badc32c 100644 --- a/tox.ini +++ b/tox.ini @@ -15,6 +15,13 @@ deps = pytest pytest-cov coverage +# Unfortunately, tox does not allow separate installation flags for the project +# dependencies and the test dependencies. When running tox, we want to install the +# project dependencies with the --pre flag, so that we get the latest version of all +# dependencies. We do the installation step ourselves for this reason. +skip_install = true +commands_pre = + pip install --pre -e . commands = pytest --basetemp="{envtmpdir}" {posargs:--color=yes --cov=dissect --cov-report=term-missing -v tests} coverage report