1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 openslide,
7 pillow,
8 pytestCheckHook,
9 pythonOlder,
10}:
11
12buildPythonPackage rec {
13 pname = "openslide";
14 version = "1.4.2";
15 pyproject = true;
16
17 disabled = pythonOlder "3.9";
18
19 src = fetchFromGitHub {
20 owner = "openslide";
21 repo = "openslide-python";
22 tag = "v${version}";
23 hash = "sha256-iI92lsW+hshMxl2rtc3/iq0LmQBuvpwqpqJXMXcCiLc=";
24 };
25
26 postPatch = ''
27 substituteInPlace openslide/lowlevel.py \
28 --replace-fail "return cdll.LoadLibrary(names[0])" "return cdll.LoadLibrary(f'${lib.getLib openslide}/lib/{names[0]}')"
29 '';
30
31 build-system = [ setuptools ];
32
33 dependencies = [ pillow ];
34
35 pythonImportsCheck = [ "openslide" ];
36
37 nativeCheckInputs = [ pytestCheckHook ];
38
39 preCheck = ''rm -rf openslide/'';
40
41 meta = {
42 description = "Python bindings to the OpenSlide library for reading whole-slide microscopy images";
43 homepage = "https://github.com/openslide/openslide-python";
44 changelog = "https://github.com/openslide/openslide-python/blob/${src.tag}/CHANGELOG.md";
45 license = lib.licenses.lgpl21Only;
46 maintainers = with lib.maintainers; [ bcdarwin ];
47 };
48}