From dcbe273527ac472225d193e1ad564af4f630dcda Mon Sep 17 00:00:00 2001 From: Schamper <1254028+Schamper@users.noreply.github.com> Date: Fri, 24 May 2024 10:51:02 +0200 Subject: [PATCH 1/2] Compatibility with cstruct v4 --- dissect/esedb/c_esedb.py | 7 +++---- pyproject.toml | 4 ++-- tox.ini | 7 +++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/dissect/esedb/c_esedb.py b/dissect/esedb/c_esedb.py index 8bc95bb..13b1ffc 100644 --- a/dissect/esedb/c_esedb.py +++ b/dissect/esedb/c_esedb.py @@ -4,10 +4,10 @@ from collections import namedtuple from typing import Union -from dissect import cstruct +from dissect.cstruct import cstruct # https://github.com/microsoft/Extensible-Storage-Engine -c_esedb_def = """ +esedb_def = """ #define MAX_COMPUTERNAME_LENGTH 15 typedef int64 DBTIME; @@ -427,8 +427,7 @@ }; """ # noqa E501 -c_esedb = cstruct.cstruct() -c_esedb.load(c_esedb_def) +c_esedb = cstruct().load(esedb_def) ulDAEMagic = 0x89ABCDEF pgnoFDPMSO = 4 diff --git a/pyproject.toml b/pyproject.toml index 9b535ea..98267a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,8 +25,8 @@ classifiers = [ "Topic :: Utilities", ] dependencies = [ - "dissect.cstruct>=3.4.dev,<4.0.dev", - "dissect.util>=3.5.dev,<4.0.dev", + "dissect.cstruct>3,<5", + "dissect.util>3.4,<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 From 97eee02012411e470a0966e9ed09d22d51c268f2 Mon Sep 17 00:00:00 2001 From: pyrco <105293448+pyrco@users.noreply.github.com> Date: Thu, 30 May 2024 13:49:32 +0200 Subject: [PATCH 2/2] Use a dev extra instead of installing with --pre --- pyproject.toml | 10 ++++++++-- tox.ini | 8 +------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 98267a9..acb7eb2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,8 +25,8 @@ classifiers = [ "Topic :: Utilities", ] dependencies = [ - "dissect.cstruct>3,<5", - "dissect.util>3.4,<4", + "dissect.cstruct>=4.dev,<5", + "dissect.util>=3.5,<4", ] dynamic = ["version"] @@ -35,6 +35,12 @@ homepage = "https://dissect.tools" documentation = "https://docs.dissect.tools/en/latest/projects/dissect.esedb" repository = "https://github.com/fox-it/dissect.esedb" +[project.optional-dependencies] +dev = [ + "dissect.cstruct>=4.0.dev,<5.0.dev", + "dissect.util>=3.5.dev,<4.0.dev", +] + [tool.black] line-length = 120 diff --git a/tox.ini b/tox.ini index badc32c..7bd2890 100644 --- a/tox.ini +++ b/tox.ini @@ -11,17 +11,11 @@ minversion = 4.4.3 requires = virtualenv>=20.16.6 [testenv] +extras = dev 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