about summary refs log tree commit diff
path: root/pkgs/development/python-modules/filemagic
diff options
context:
space:
mode:
authorErik Arvstedt <erik.arvstedt@gmail.com>2019-01-27 15:26:23 +0100
committerErik Arvstedt <erik.arvstedt@gmail.com>2019-04-29 11:41:42 +0200
commit071f3b34e62a7142cd3d3310af2ad7e11fe528d6 (patch)
tree4105e79b09a625bcf333371bcdf32d21825d9950 /pkgs/development/python-modules/filemagic
parent535c38dd7330a152cf56407602f8a2305f374bb8 (diff)
pythonPackages.filemagic: init at 1.6
Diffstat (limited to 'pkgs/development/python-modules/filemagic')
-rw-r--r--pkgs/development/python-modules/filemagic/default.nix29
1 files changed, 29 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/filemagic/default.nix b/pkgs/development/python-modules/filemagic/default.nix
new file mode 100644
index 0000000000000..731b83294a8fe
--- /dev/null
+++ b/pkgs/development/python-modules/filemagic/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, lib, buildPythonPackage, fetchFromGitHub, file
+, isPy3k, mock, unittest2 }:
+
+buildPythonPackage rec {
+  pname = "filemagic";
+  version = "1.6";
+
+  # Don't use the PyPI source because it's missing files required for testing
+  src = fetchFromGitHub {
+    owner = "aliles";
+    repo = "filemagic";
+    rev = "138649062f769fb10c256e454a3e94ecfbf3017b";
+    sha256 = "1jxf928jjl2v6zv8kdnfqvywdwql1zqkm1v5xn1d5w0qjcg38d4n";
+  };
+
+  postPatch = ''
+    substituteInPlace magic/api.py --replace "ctypes.util.find_library('magic')" \
+      "'${file}/lib/libmagic${stdenv.hostPlatform.extensions.sharedLibrary}'"
+  '';
+
+  checkInputs = [ (if isPy3k then mock else unittest2) ];
+
+  meta = with lib; {
+    description = "File type identification using libmagic";
+    homepage = https://github.com/aliles/filemagic;
+    license = licenses.asl20;
+    maintainers = with maintainers; [ earvstedt ];
+  };
+}