https://github.com/synodriver/pyarchive
fast, feature-rich python binding for libarchive, support read, write and create disk ojects, with a wrapper around python file-like objects
https://github.com/synodriver/pyarchive
bindings cython libarchive python
Last synced: about 2 months ago
JSON representation
fast, feature-rich python binding for libarchive, support read, write and create disk ojects, with a wrapper around python file-like objects
- Host: GitHub
- URL: https://github.com/synodriver/pyarchive
- Owner: synodriver
- Created: 2023-06-19T11:15:18.000Z (almost 2 years ago)
- Default Branch: use_init
- Last Pushed: 2023-07-23T15:37:51.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T11:26:19.482Z (7 months ago)
- Topics: bindings, cython, libarchive, python
- Language: Cython
- Homepage:
- Size: 2.79 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.markdown
- Changelog: changename.py
Awesome Lists containing this project
README
# pyarchive
Pyarchive provide a bridge between file-like objects and libarchive, making it easy to
use and extend libarchive itself. For instance, libarchive [doesn't support bzip3](https://github.com/libarchive/libarchive/issues/1904) at
this moment, however, pyarchive can do that with the help of other libraries.
```python
import bz3
from pyarchive import ArchiveReadwith bz3.open("test.tar.bz3", 'rb') as f:
a = ArchiveRead()
a.support_filter_all()
a.support_format_all()
a.open(f, 1000)
for entry in a.iter_entries():
print(entry.pathname_w)
a.skip()
```
Besides, it's also possible to read a file in memory using ```open_memory``` method,
and read a fd using ```open_fd```# Build
Build pyarchive with all features available is not very easy, especially
on Windows, you'll have to link against the right libarchive. The recommend
way is to use a conda environment. Use ```conda install -c conda-forge libarchive```
to install a pre-build libarchive with header-files available, and build use
the following script```bash
python -m pip install -r requirements.txt
python setup.py sdist bdist_wheel --use-cython --lib-path "D:\conda\envs\py310\Library\lib\archive.lib" --include-path "D:\conda\envs\py310\Library\include"
```
On linux, this may be```bash
python -m pip install -r requirements.txt
python setup.py sdist bdist_wheel --use-cython --lib-path "/root/conda/envs/py310/Library/lib/libarchive.so" --include-path "/root/conda/envs/py310/Library/include"
```
The path should depend on where you install conda# Develop
Use
```bash
python -m pip install -r requirements.txt
python setup.py build_ext -i --use-cython --debug --lib-path "D:\conda\envs\py310\Library\lib\archive.lib" --include-path "D:\conda\envs\py310\Library\include"
```
and so on