2021-02-28 10:32:30 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, python
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, substituteAll
|
|
|
|
, file
|
|
|
|
, glibcLocales
|
|
|
|
}:
|
2018-02-09 12:16:04 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "python-magic";
|
2021-02-20 09:09:15 +00:00
|
|
|
version = "0.4.22";
|
2018-02-09 12:16:04 +00:00
|
|
|
|
2021-02-28 10:32:30 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ahupp";
|
|
|
|
repo = "python-magic";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "0zbdjr5shijs0jayz7gycpx0kn6v2bh83dpanyajk2vmy47jvbd6";
|
2018-02-09 12:16:04 +00:00
|
|
|
};
|
|
|
|
|
2021-02-28 10:32:30 +00:00
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./libmagic-path.patch;
|
|
|
|
libmagic = "${file}/lib/libmagic${stdenv.hostPlatform.extensions.sharedLibrary}";
|
|
|
|
})
|
|
|
|
];
|
2018-02-09 12:16:04 +00:00
|
|
|
|
2021-02-28 10:32:30 +00:00
|
|
|
checkInputs = [ glibcLocales ];
|
2018-02-09 12:16:04 +00:00
|
|
|
|
2021-02-28 10:32:30 +00:00
|
|
|
checkPhase = ''
|
|
|
|
LC_ALL="en_US.UTF-8" ${python.interpreter} test/test.py
|
|
|
|
'';
|
2018-02-09 12:16:04 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A python interface to the libmagic file type identification library";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/ahupp/python-magic";
|
2018-02-09 12:16:04 +00:00
|
|
|
license = lib.licenses.mit;
|
|
|
|
};
|
|
|
|
}
|