1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 pytestCheckHook,
7 p7zip,
8 cabextract,
9 zip,
10 lzip,
11 zpaq,
12 gnutar,
13 unar, # Free alternative to unrar
14 gnugrep,
15 diffutils,
16 file,
17 gzip,
18 bzip2,
19 xz,
20}:
21
22let
23 compression-utilities = [
24 p7zip
25 gnutar
26 unar
27 cabextract
28 zip
29 lzip
30 zpaq
31 gzip
32 gnugrep
33 diffutils
34 bzip2
35 file
36 xz
37 ];
38in
39buildPythonPackage rec {
40 pname = "patool";
41 version = "2.1.1";
42 format = "setuptools";
43
44 #pypi doesn't have test data
45 src = fetchFromGitHub {
46 owner = "wummel";
47 repo = pname;
48 rev = "upstream/${version}";
49 hash = "sha256-B2P6JldMOAxr4WS+wST+kRVvEm41zH3Nh5LLKoFOws4=";
50 };
51
52 postPatch = ''
53 substituteInPlace patoolib/util.py \
54 --replace "path = None" 'path = os.environ["PATH"] + ":${lib.makeBinPath compression-utilities}"'
55 '';
56
57 nativeCheckInputs = [ pytestCheckHook ] ++ compression-utilities;
58
59 disabledTests = [
60 "test_unzip"
61 "test_unzip_file"
62 "test_zip"
63 "test_zip_file"
64 ] ++ lib.optionals stdenv.isDarwin [ "test_ar" ];
65
66 meta = with lib; {
67 description = "portable archive file manager";
68 mainProgram = "patool";
69 homepage = "https://wummel.github.io/patool/";
70 license = licenses.gpl3;
71 maintainers = with maintainers; [ marius851000 ];
72 };
73}