Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with cstruct v4 #30

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions dissect/vmfs/c_vmfs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import stat
import struct

from dissect import cstruct
from dissect.cstruct import cstruct

vmfs_def = """
/* === System file addresses === */
Expand Down Expand Up @@ -368,8 +368,7 @@
};
"""

c_vmfs = cstruct.cstruct()
c_vmfs.load(vmfs_def)
c_vmfs = cstruct().load(vmfs_def)

ADDRESS_TYPE_MASK = 7
ResourceType = c_vmfs.ResourceType
Expand Down
3 changes: 1 addition & 2 deletions dissect/vmfs/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,7 @@ def open(self, resource_type, address=None, fileobj=None):
return None

def _get_resource_for_resource_type(self, resource_type):
if not isinstance(resource_type, int):
resource_type = resource_type.value
resource_type = int(resource_type)

if resource_type not in self.resources:
raise ValueError(f"No resource opened for type {ResourceType(resource_type)}")
Expand Down
10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand All @@ -35,6 +35,12 @@ homepage = "https://dissect.tools"
documentation = "https://docs.dissect.tools/en/latest/projects/dissect.vmfs"
repository = "https://github.com/fox-it/dissect.vmfs"

[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

Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ minversion = 4.4.3
requires = virtualenv>=20.16.6

[testenv]
extras = dev
deps =
pytest
pytest-cov
Expand Down