2019-01-27 15:26:23 +01:00
|
|
|
{ stdenv, lib, buildPythonPackage, fetchFromGitHub, file
|
|
|
|
, isPy3k, mock, unittest2 }:
|
|
|
|
|
2019-08-13 23:52:01 +02:00
|
|
|
buildPythonPackage {
|
2019-01-27 15:26:23 +01:00
|
|
|
pname = "filemagic";
|
|
|
|
version = "1.6";
|
2020-06-16 22:56:39 +02:00
|
|
|
disabled = !isPy3k; # asserts on ResourceWarning
|
2019-01-27 15:26:23 +01:00
|
|
|
|
|
|
|
# Don't use the PyPI source because it's missing files required for testing
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "aliles";
|
|
|
|
repo = "filemagic";
|
|
|
|
rev = "138649062f769fb10c256e454a3e94ecfbf3017b";
|
|
|
|
sha256 = "1jxf928jjl2v6zv8kdnfqvywdwql1zqkm1v5xn1d5w0qjcg38d4n";
|
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace magic/api.py --replace "ctypes.util.find_library('magic')" \
|
|
|
|
"'${file}/lib/libmagic${stdenv.hostPlatform.extensions.sharedLibrary}'"
|
|
|
|
'';
|
|
|
|
|
2020-06-16 22:56:39 +02:00
|
|
|
checkInputs = [ mock ] ++ lib.optionals (!isPy3k) [ unittest2 ];
|
2019-01-27 15:26:23 +01:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "File type identification using libmagic";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/aliles/filemagic";
|
2019-01-27 15:26:23 +01:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ earvstedt ];
|
|
|
|
};
|
|
|
|
}
|