Merge pull request #309998 from TomaSajt/glymur
python312Packages.glymur: 0.12.5 -> 0.13.2, unbreak, refactor
This commit is contained in:
commit
5c31c00140
2 changed files with 47 additions and 16 deletions
|
@ -1,10 +1,13 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, buildPythonPackage
|
||||
, substituteAll
|
||||
, glibc
|
||||
, libtiff
|
||||
, openjpeg
|
||||
, fetchFromGitHub
|
||||
, lxml
|
||||
, numpy
|
||||
, openjpeg
|
||||
, pytestCheckHook
|
||||
, pythonOlder
|
||||
, scikit-image
|
||||
|
@ -13,54 +16,66 @@
|
|||
|
||||
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 = [
|
||||
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}";
|
||||
})
|
||||
];
|
||||
|
||||
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
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
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"
|
||||
];
|
||||
|
||||
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 ];
|
||||
};
|
||||
}
|
||||
|
|
16
pkgs/development/python-modules/glymur/set-lib-paths.patch
Normal file
16
pkgs/development/python-modules/glymur/set-lib-paths.patch
Normal file
|
@ -0,0 +1,16 @@
|
|||
diff --git a/glymur/config.py b/glymur/config.py
|
||||
index 962e299..dab44ba 100644
|
||||
--- a/glymur/config.py
|
||||
+++ b/glymur/config.py
|
||||
@@ -53,6 +53,11 @@ def _determine_full_path(libname):
|
||||
if path is not None:
|
||||
return path
|
||||
|
||||
+ if libname == "openjp2":
|
||||
+ return "@openjp2_lib@"
|
||||
+ if libname == "tiff":
|
||||
+ return "@tiff_lib@"
|
||||
+
|
||||
# No joy on config file. Cygwin? Cygwin is a bit of an odd case.
|
||||
if platform.system().startswith('CYGWIN'):
|
||||
g = pathlib.Path('/usr/bin').glob('cygopenjp2*.dll')
|
Loading…
Reference in a new issue