1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 pytestCheckHook,
7 easyprocess,
8 entrypoint2,
9 patool,
10 cabextract,
11}:
12
13buildPythonPackage rec {
14 pname = "pyunpack";
15 version = "0.3";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "ponty";
20 repo = "pyunpack";
21 rev = "refs/tags/${version}";
22 hash = "sha256-1MAdiX6+u35f6S8a0ZcIIebZE8bbxTy+0TnMohJ7J6s=";
23 };
24
25 postPatch = ''
26 substituteInPlace pyunpack/__init__.py \
27 --replace-fail \
28 '_exepath("patool")' \
29 '"${lib.getBin patool}/bin/.patool-wrapped"'
30 '';
31
32 nativeBuildInputs = [ setuptools ];
33
34 dependencies = [
35 easyprocess
36 entrypoint2
37 ];
38
39 nativeCheckInputs = [
40 pytestCheckHook
41 cabextract
42 ];
43
44 pytestFlagsArray = [ "-x" ];
45
46 pythonImportsCheck = [ "pyunpack" ];
47
48 disabledTestPaths = [
49 # unfree
50 "tests/test_rar.py"
51
52 # We get "patool: error: unrecognized arguments: --password 123"
53 # The currently packaged version of patool does not support this flag.
54 # https://github.com/wummel/patool/issues/114
55 # FIXME: Re-enable these once patool is updated
56 "tests/test_rarpw.py"
57 "tests/test_zippw.py"
58 ];
59
60 meta = with lib; {
61 description = "Unpack archive files in python";
62 homepage = "https://github.com/ponty/pyunpack";
63 license = licenses.bsd2;
64 maintainers = with maintainers; [ pbsds ];
65 };
66}