diff --git a/pkgs/tools/misc/file/python.patch b/pkgs/tools/misc/file/python.patch new file mode 100644 index 00000000000..8ecbc9a81fd --- /dev/null +++ b/pkgs/tools/misc/file/python.patch @@ -0,0 +1,11 @@ +--- file-5.11/python/magic.py 2011-09-22 18:57:41.000000000 +0200 ++++ file-5.11/python/magic.py.1 2012-04-30 15:00:31.750213810 +0200 +@@ -13,7 +13,7 @@ + Loads the shared library through ctypes and returns a library + L{ctypes.CDLL} instance + """ +- return ctypes.cdll.LoadLibrary(find_library('magic')) ++ return ctypes.CDLL('libmagic.so') + + _libraries = {} + _libraries['magic'] = _init() diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index cd75cf8439e..80107221022 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1612,7 +1612,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { colander deform deform_bootstrap - magic + python_magic pyyaml cryptacular hypatia @@ -2743,7 +2743,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { }); - magic = buildPythonPackage rec { + python_magic = buildPythonPackage rec { # TODO: wait for release 0.4.3+ rev = "9f18d2c125b2f0240caec7096625834624cc4c20"; name = "python-magic-${rev}"; @@ -2770,6 +2770,28 @@ pythonPackages = modules // import ./python-packages-generated.nix { }; }; + magic = pkgs.stdenv.mkDerivation rec { + name = "python-${pkgs.file.name}"; + + src = pkgs.file.src; + + patches = [ ../tools/misc/file/python.patch ]; + buildInputs = [ python pkgs.file ]; + + configurePhase = "cd python"; + + buildPhase = "${python}/bin/${python.executable} setup.py build"; + + installPhase = '' + ${python}/bin/${python.executable} setup.py install --prefix=$out + ''; + + meta = { + description = "A Python wrapper around libmagic"; + homepage = http://www.darwinsys.com/file/; + }; + }; + m2crypto = buildPythonPackage rec { version = "0.21.1";