2021-03-09 03:18:52 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2023-02-16 17:41:37 +00:00
|
|
|
, fetchpatch
|
2021-03-09 03:18:52 +00:00
|
|
|
, substituteAll
|
|
|
|
, file
|
2022-06-16 17:23:12 +00:00
|
|
|
, pytestCheckHook
|
2021-03-09 03:18:52 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "python-magic";
|
2022-06-26 10:26:21 +00:00
|
|
|
version = "0.4.27";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ahupp";
|
|
|
|
repo = "python-magic";
|
|
|
|
rev = version;
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-fZ+5xJ3P0EYK+6rQ8VzXv2zckKfEH5VUdISIR6ybIfQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./libmagic-path.patch;
|
|
|
|
libmagic = "${file}/lib/libmagic${stdenv.hostPlatform.extensions.sharedLibrary}";
|
|
|
|
})
|
2023-02-16 17:41:37 +00:00
|
|
|
(fetchpatch {
|
|
|
|
name = "update-test-for-upstream-added-gzip-extensions.patch";
|
|
|
|
url = "https://github.com/ahupp/python-magic/commit/4ffcd59113fa26d7c2e9d5897b1eef919fd4b457.patch";
|
|
|
|
hash = "sha256-67GpjlGiR4/os/iZ69V+ZziVLpjmid+7t+gQ2aQy9I0=";
|
|
|
|
})
|
2023-10-09 19:29:22 +00:00
|
|
|
|
|
|
|
# Upstream patch to amend test suite for-5.45:
|
|
|
|
# https://github.com/ahupp/python-magic/pull/290
|
|
|
|
(fetchpatch {
|
|
|
|
name = "file-5.45.patch";
|
|
|
|
url = "https://github.com/ahupp/python-magic/commit/3d2405ca80cd39b2a91decd26af81dcf181390a4.patch";
|
|
|
|
hash = "sha256-HRsnO9MGfMD9BkJdC4SrEFQ1OZEaXpwakXFLoaCPK94=";
|
|
|
|
})
|
2021-03-09 03:18:52 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
preCheck = ''
|
|
|
|
export LC_ALL=en_US.UTF-8
|
2021-03-09 03:18:52 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-06-16 17:23:12 +00:00
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A python interface to the libmagic file type identification library";
|
|
|
|
homepage = "https://github.com/ahupp/python-magic";
|
2021-08-05 21:33:18 +00:00
|
|
|
license = licenses.mit;
|
2023-08-04 22:07:22 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|