diff options
Diffstat (limited to 'pkgs/development/python-modules/python-magic/default.nix')
-rw-r--r-- | pkgs/development/python-modules/python-magic/default.nix | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/pkgs/development/python-modules/python-magic/default.nix b/pkgs/development/python-modules/python-magic/default.nix index 61a7dd315df..6737f126073 100644 --- a/pkgs/development/python-modules/python-magic/default.nix +++ b/pkgs/development/python-modules/python-magic/default.nix @@ -1,24 +1,36 @@ -{ buildPythonPackage, lib, fetchPypi, file, stdenv }: +{ lib +, stdenv +, python +, buildPythonPackage +, fetchFromGitHub +, substituteAll +, file +, glibcLocales +}: buildPythonPackage rec { pname = "python-magic"; - version = "0.4.18"; + version = "0.4.22"; - src = fetchPypi { - inherit pname version; - sha256 = "b757db2a5289ea3f1ced9e60f072965243ea43a2221430048fd8cacab17be0ce"; + src = fetchFromGitHub { + owner = "ahupp"; + repo = "python-magic"; + rev = version; + sha256 = "0zbdjr5shijs0jayz7gycpx0kn6v2bh83dpanyajk2vmy47jvbd6"; }; - postPatch = '' - substituteInPlace magic.py --replace "ctypes.util.find_library('magic')" "'${file}/lib/libmagic${stdenv.hostPlatform.extensions.sharedLibrary}'" - ''; + patches = [ + (substituteAll { + src = ./libmagic-path.patch; + libmagic = "${file}/lib/libmagic${stdenv.hostPlatform.extensions.sharedLibrary}"; + }) + ]; - doCheck = false; + checkInputs = [ glibcLocales ]; - # TODO: tests are failing - #checkPhase = '' - # ${python}/bin/${python.executable} ./test.py - #''; + checkPhase = '' + LC_ALL="en_US.UTF-8" ${python.interpreter} test/test.py + ''; meta = { description = "A python interface to the libmagic file type identification library"; |