2023-02-16 17:41:37 +00:00
|
|
|
{ lib, buildPythonPackage, fetchFromGitHub, fetchurl, pytestCheckHook, p7zip,
|
2022-07-18 16:21:45 +00:00
|
|
|
cabextract, zip, lzip, zpaq, gnutar, gnugrep, diffutils, file,
|
2020-10-27 00:29:36 +00:00
|
|
|
gzip, bzip2, xz}:
|
|
|
|
|
|
|
|
# unrar is unfree, as well as 7z with unrar support, not including it (patool doesn't support unar)
|
2022-07-18 16:21:45 +00:00
|
|
|
# it will still use unrar if present in the path
|
2020-10-27 00:29:36 +00:00
|
|
|
|
|
|
|
let
|
2023-02-16 17:41:37 +00:00
|
|
|
# FIXME: backport a patch in `file` that seemingly only affects this package
|
|
|
|
# Revert when fix to main package makes it through staging.
|
|
|
|
file' = file.overrideAttrs(old: {
|
|
|
|
patches = (old.patches or []) ++ [
|
|
|
|
(fetchurl {
|
|
|
|
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-apps/file/files/file-5.44-decompress-empty.patch?h=dfc57da515a2aaf085bea68267cc727f1bfaa691";
|
|
|
|
hash = "sha256-fUzRQAlLWczBmR5iA1Gk66mHjP40MJcMdgCtm2+u1SQ=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
2020-10-27 00:29:36 +00:00
|
|
|
compression-utilities = [
|
|
|
|
p7zip
|
|
|
|
gnutar
|
|
|
|
cabextract
|
|
|
|
zip
|
|
|
|
lzip
|
|
|
|
zpaq
|
|
|
|
gzip
|
|
|
|
gnugrep
|
|
|
|
diffutils
|
|
|
|
bzip2
|
2023-02-16 17:41:37 +00:00
|
|
|
file'
|
2020-10-27 00:29:36 +00:00
|
|
|
xz
|
|
|
|
];
|
|
|
|
in
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "patool";
|
|
|
|
version = "1.12";
|
|
|
|
|
|
|
|
#pypi doesn't have test data
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "wummel";
|
|
|
|
repo = pname;
|
|
|
|
rev = "upstream/${version}";
|
|
|
|
sha256 = "0v4r77sm3yzh7y1whfwxmp01cchd82jbhvbg9zsyd2yb944imzjy";
|
|
|
|
};
|
|
|
|
|
2022-07-18 16:21:45 +00:00
|
|
|
postPatch = ''
|
2020-10-27 00:29:36 +00:00
|
|
|
substituteInPlace patoolib/util.py \
|
2022-07-18 16:21:45 +00:00
|
|
|
--replace "path = None" 'path = os.environ["PATH"] + ":${lib.makeBinPath compression-utilities}"'
|
2020-10-27 00:29:36 +00:00
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ] ++ compression-utilities;
|
2020-10-27 00:29:36 +00:00
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
"test_unzip"
|
|
|
|
"test_unzip_file"
|
|
|
|
"test_zip"
|
|
|
|
"test_zip_file"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "portable archive file manager";
|
|
|
|
homepage = "https://wummel.github.io/patool/";
|
|
|
|
license = licenses.gpl3;
|
|
|
|
maintainers = with maintainers; [ marius851000 ];
|
|
|
|
};
|
|
|
|
}
|