Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / patool / default.nix
blob7d22c167a356db0929f8170e4133dfedb4610823
1 { lib
2 , buildPythonPackage
3 , fetchFromGitHub
4 , fetchpatch
5 , pytestCheckHook
6 , p7zip
7 , cabextract
8 , zip
9 , lzip
10 , zpaq
11 , gnutar
12 , gnugrep
13 , diffutils
14 , file
15 , gzip
16 , bzip2
17 , xz
20 # unrar is unfree, as well as 7z with unrar support, not including it (patool doesn't support unar)
21 # it will still use unrar if present in the path
23 let
24   compression-utilities = [
25     p7zip
26     gnutar
27     cabextract
28     zip
29     lzip
30     zpaq
31     gzip
32     gnugrep
33     diffutils
34     bzip2
35     file
36     xz
37   ];
39 buildPythonPackage rec {
40   pname = "patool";
41   version = "1.12";
42   format = "setuptools";
44   #pypi doesn't have test data
45   src = fetchFromGitHub {
46     owner = "wummel";
47     repo = pname;
48     rev = "upstream/${version}";
49     hash = "sha256-Xv4aCUnLi+b1T29tuKRADTIWwK2dO8iDP/D7UfU5mWw=";
50   };
52   patches = [
53     # https://github.com/wummel/patool/pull/63
54     (fetchpatch {
55       name = "apk-sometimes-has-mime-jar.patch";
56       url = "https://github.com/wummel/patool/commit/a9f3ee3d639a1065be024001e89c0b153511b16b.patch";
57       hash = "sha256-a4aWqHHc/cBs5T2QKZ08ky1K1tqKZEgqVmTmV11aTVE=";
58     })
59     # https://github.com/wummel/patool/pull/130
60     (fetchpatch {
61       name = "apk-sometimes-has-mime-android-package.patch";
62       url = "https://github.com/wummel/patool/commit/e8a1eea1d273b278a1b6f5029d2e21cb18bc9ffd.patch";
63       hash = "sha256-AVooVdU4FNIixUfwyrn39N2SDFHNs4CUYzS5Eey+DrU=";
64     })
65   ];
67   postPatch = ''
68     substituteInPlace patoolib/util.py \
69       --replace "path = None" 'path = os.environ["PATH"] + ":${lib.makeBinPath compression-utilities}"'
70   '';
72   nativeCheckInputs = [ pytestCheckHook ] ++ compression-utilities;
74   disabledTests = [
75     "test_unzip"
76     "test_unzip_file"
77     "test_zip"
78     "test_zip_file"
79   ];
81   meta = with lib; {
82     description = "portable archive file manager";
83     homepage = "https://wummel.github.io/patool/";
84     license = licenses.gpl3;
85     maintainers = with maintainers; [ marius851000 ];
86   };