1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 unrar,
7}:
8
9buildPythonPackage rec {
10 pname = "unrardll";
11 version = "0.1.7";
12 format = "setuptools";
13
14 src = fetchPypi {
15 inherit pname version;
16 hash = "sha256-4QZ/4nu03iBO+PNpLyPZPF07QpL3iyksb8fcT3V0n3Y=";
17 };
18
19 buildInputs = [ unrar ];
20
21 NIX_CFLAGS_LINK = lib.optionalString stdenv.hostPlatform.isDarwin "-headerpad_max_install_names";
22
23 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
24 install_name_tool -change libunrar.so ${unrar}/lib/libunrar.so $out/lib/python*/site-packages/unrardll/unrar.*-darwin.so
25 install_name_tool -change libunrar.so ${unrar}/lib/libunrar.so build/lib.*/unrardll/unrar.*-darwin.so
26 '';
27
28 pythonImportsCheck = [ "unrardll" ];
29
30 meta = with lib; {
31 description = "Wrap the Unrar DLL to enable unraring of files in python";
32 homepage = "https://github.com/kovidgoyal/unrardll";
33 license = licenses.bsd3;
34 maintainers = with maintainers; [ nyanloutre ];
35 };
36}