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