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

Move the selection between the native and Python implementations of lzo and lz4 to dissect.util #16

Merged
merged 1 commit into from
Jul 29, 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
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,17 @@ Information on the supported Python versions can be found in the Getting Started
pip install dissect.btrfs
```

This module is also automatically installed if you install the `dissect` package.
This project decompresses lzo compressed file systems and can use the faster, native (C-based) lzo implementation when
installed, instead of the slower pure Python implementation provided by `dissect.util`. To use these faster
implementations, install the package with the lzo extra:

```bash
pip install "dissect.btrfs[lzo]"
```

Unfortunately there is no binary `python-lzo` wheel for PyPy installations on Windows, so it won't be installed there.

This module including the lzo extra is also automatically installed if you install the `dissect` package.

## Build and test instructions

Expand Down
6 changes: 1 addition & 5 deletions dissect/btrfs/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@
from typing import TYPE_CHECKING, BinaryIO, NamedTuple
from uuid import UUID

from dissect.util.compression import lzo
from dissect.util.stream import AlignedStream

try:
import lzo
except ImportError:
from dissect.util.compression import lzo

try:
import zstandard

Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ repository = "https://github.com/fox-it/dissect.btrfs"

[project.optional-dependencies]
full = [
# There are no Windows PyPy wheels available for python-lzo
# So we use a pure python fallback for it.
"python-lzo; platform_system != 'Windows' or platform_python_implementation != 'PyPy'",
"zstandard",
]
gcrc32 = [
"google-crc32c",
]
lzo = [
# There are no Windows PyPy wheels available for python-lzo
# So we use a pure python fallback for it.
"python-lzo; platform_system != 'Windows' or platform_python_implementation != 'PyPy'",
]
dev = [
"dissect.btrfs[full]",
"dissect.cstruct>=4.0.dev,<5.0.dev",
Expand Down