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 tag = 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 pytestFlags = [ "-x" ];
45
46 pythonImportsCheck = [ "pyunpack" ];
47
48 disabledTests = [
49 # pinning test of `--help` sensitive to python version
50 "test_help"
51 ];
52
53 disabledTestPaths = [
54 # unfree
55 "tests/test_rar.py"
56
57 # We get "patool: error: unrecognized arguments: --password 123"
58 # The currently packaged version of patool does not support this flag.
59 # https://github.com/wummel/patool/issues/114
60 # FIXME: Re-enable these once patool is updated
61 "tests/test_rarpw.py"
62 "tests/test_zippw.py"
63 ];
64
65 meta = with lib; {
66 description = "Unpack archive files in python";
67 homepage = "https://github.com/ponty/pyunpack";
68 license = licenses.bsd2;
69 maintainers = with maintainers; [ pbsds ];
70 };
71}