about summary refs log tree commit diff
path: root/pkgs/development/python-modules/glymur/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/glymur/default.nix')
-rw-r--r--pkgs/development/python-modules/glymur/default.nix72
1 files changed, 42 insertions, 30 deletions
diff --git a/pkgs/development/python-modules/glymur/default.nix b/pkgs/development/python-modules/glymur/default.nix
index 4ff23443e40d2..611c87e1fe3a9 100644
--- a/pkgs/development/python-modules/glymur/default.nix
+++ b/pkgs/development/python-modules/glymur/default.nix
@@ -1,66 +1,78 @@
-{ lib
-, stdenv
-, buildPythonPackage
-, fetchFromGitHub
-, lxml
-, numpy
-, openjpeg
-, pytestCheckHook
-, pythonOlder
-, scikit-image
-, setuptools
+{
+  lib,
+  stdenv,
+  buildPythonPackage,
+  substituteAll,
+  glibc,
+  libtiff,
+  openjpeg,
+  fetchFromGitHub,
+  lxml,
+  numpy,
+  pytestCheckHook,
+  pythonOlder,
+  scikit-image,
+  setuptools,
 }:
 
 buildPythonPackage rec {
   pname = "glymur";
-  version = "0.12.5";
-  format = "pyproject";
+  version = "0.13.2";
+  pyproject = true;
 
   disabled = pythonOlder "3.6";
 
   src = fetchFromGitHub {
     owner = "quintusdias";
-    repo = pname;
+    repo = "glymur";
     rev = "refs/tags/v${version}";
-    hash = "sha256-9NMSAt5yFRnlCUDP37/ozhDsS8FTdRkfjUz8kQwWzVc=";
+    hash = "sha256-GUqe9mdMm2O/cbZw8Reohh4X1kO+xOMWHb83PjNvdu8=";
   };
 
-  nativeBuildInputs = [
-    setuptools
+  patches = [
+    (substituteAll {
+      src = ./set-lib-paths.patch;
+      openjp2_lib = "${lib.getLib openjpeg}/lib/libopenjp2${stdenv.hostPlatform.extensions.sharedLibrary}";
+      tiff_lib = "${lib.getLib libtiff}/lib/libtiff${stdenv.hostPlatform.extensions.sharedLibrary}";
+    })
   ];
 
-  propagatedBuildInputs = [
+  postPatch = lib.optionalString (!stdenv.isDarwin) ''
+    substituteInPlace glymur/lib/tiff.py \
+        --replace-fail "glymur_config('c')" "ctypes.CDLL('${lib.getLib glibc}/lib/libc.so.6')"
+  '';
+
+  __propagatedImpureHostDeps = lib.optional stdenv.isDarwin "/usr/lib/libc.dylib";
+
+  build-system = [ setuptools ];
+
+  dependencies = [
+    lxml
     numpy
   ];
 
   nativeCheckInputs = [
-    lxml
     pytestCheckHook
     scikit-image
   ];
 
-  postConfigure = ''
-    substituteInPlace glymur/config.py \
-    --replace "path = read_config_file(libname)" "path = '${openjpeg}/lib/lib' + libname + ${if stdenv.isDarwin then "'.dylib'" else "'.so'"}"
+  preCheck = ''
+    export PATH="$out/bin:$PATH"
   '';
 
   disabledTestPaths = [
     # this test involves glymur's different ways of finding the openjpeg path on
     # fsh systems by reading an .rc file and such, and is obviated by the patch
-    # in postConfigure
     "tests/test_config.py"
-    "tests/test_tiff2jp2.py"
   ];
 
-  pythonImportsCheck = [
-    "glymur"
-  ];
+  pythonImportsCheck = [ "glymur" ];
 
-  meta = with lib; {
+  meta = {
     description = "Tools for accessing JPEG2000 files";
     homepage = "https://github.com/quintusdias/glymur";
     changelog = "https://github.com/quintusdias/glymur/blob/v${version}/CHANGES.txt";
-    license = licenses.mit;
-    maintainers = with maintainers; [ ];
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ tomasajt ];
   };
 }