2021-03-09 03:18:52 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, python
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2021-12-06 16:07:01 +00:00
|
|
|
, fetchpatch
|
2021-03-09 03:18:52 +00:00
|
|
|
, substituteAll
|
|
|
|
, file
|
|
|
|
, glibcLocales
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "python-magic";
|
2021-08-05 21:33:18 +00:00
|
|
|
version = "0.4.24";
|
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;
|
2021-08-05 21:33:18 +00:00
|
|
|
sha256 = "17jalhjbfd600lzfz296m0nvgp6c7vx1mgz82jbzn8hgdzknf4w0";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
patches = [
|
2021-12-06 16:07:01 +00:00
|
|
|
# pull upstream patch to support file-5.41
|
|
|
|
(fetchpatch {
|
|
|
|
name = "file-5.41-compat.patch";
|
|
|
|
url = "https://github.com/ahupp/python-magic/commit/0ae7e7ceac0e80e03adc75c858bb378c0427331a.patch";
|
|
|
|
sha256 = "0vclaamb56nza1mcy88wjbkh81hnish2gzvl8visa2cknhgdmk50";
|
|
|
|
})
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
(substituteAll {
|
|
|
|
src = ./libmagic-path.patch;
|
|
|
|
libmagic = "${file}/lib/libmagic${stdenv.hostPlatform.extensions.sharedLibrary}";
|
|
|
|
})
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
checkInputs = [ glibcLocales ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
checkPhase = ''
|
|
|
|
LC_ALL="en_US.UTF-8" ${python.interpreter} test/test.py
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
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;
|
|
|
|
maintainers = with maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|