Skip to content

Commit

Permalink
Move the selection between the native and Python implementations of l…
Browse files Browse the repository at this point in the history
…zo and lz4 to dissect.util (#16)

Co-authored-by: Jan Willem Brandenburg <[email protected]>
  • Loading branch information
pyrco and Jan Willem Brandenburg authored Jul 29, 2024
1 parent 781b8e1 commit 01cbab3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
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

0 comments on commit 01cbab3

Please sign in to comment.