unrar-cffi is a python extension that exposes unrar library
functionality through a zipfile-like interface.
The package implements the following RarFile functions:
namelist()infolist()getinfo()read()open()testrar()rarfile.is_rar_file()
-
Install with PIP:
pip install unrar-cffi -
Use from code:
from unrar.cffi import rarfile
rar = rarfile.RarFile('sample.rar')
assert rar.testrar() == None
for filename in rar.namelist():
info = rar.getinfo(filename)
print("Reading {}, {}, {} bytes ({} bytes compressed)".format(info.filename, info.date_time, info.file_size, info.compress_size))
data = rar.read(filename)
print("\t{}...\n".format(data[:100]))Linux:
- gcc compiler suite (
build-essentialpackages should be enough) - docker (only for
buildmanylinux)
Windows:
- VS2017 Build Tools (PLATFORM_TOOLSET=v141)
- Visual C++ compiler suite
./build.sh init./build.sh build./build.sh test
If you have docker installed, you can build all the manylinux wheels:
./build.sh within [manylinux docker image] buildmanylinux./build.sh within [manylinux docker image] testmanylinux
By deafult the image quay.io/pypa/manylinux2010_x86_64 will be used.
Use $DOCKER_IMAGE and $PLAT variables to customize the build.