1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 cython,
8 setuptools,
9
10 # nativeBuildInputs
11 pkg-config,
12
13 # buildInputs
14 libraw,
15
16 # dependencies
17 numpy,
18
19 # tests
20 imageio,
21 pytestCheckHook,
22 scikit-image,
23}:
24
25buildPythonPackage rec {
26 pname = "rawpy";
27 version = "0.25.1";
28 pyproject = true;
29
30 src = fetchFromGitHub {
31 owner = "letmaik";
32 repo = "rawpy";
33 tag = "v${version}";
34 hash = "sha256-d3TxPW3GdCQT8bBbnveSxtWHkf5zinM8nSy4m/P7m7Q=";
35 };
36
37 build-system = [
38 cython
39 numpy
40 setuptools
41 ];
42
43 nativeBuildInputs = [
44 pkg-config
45 ];
46
47 buildInputs = [
48 libraw
49 ];
50
51 dependencies = [
52 numpy
53 ];
54
55 env = {
56 RAWPY_USE_SYSTEM_LIBRAW = 1;
57 };
58
59 pythonImportsCheck = [
60 "rawpy"
61 "rawpy._rawpy"
62 ];
63
64 # Delete the source files to load the library from the installed folder instead of the source files
65 preCheck = ''
66 rm -rf rawpy
67 '';
68
69 nativeCheckInputs = [
70 imageio
71 pytestCheckHook
72 scikit-image
73 ];
74
75 disabledTests = [
76 # rawpy._rawpy.LibRawFileUnsupportedError: b'Unsupported file format or not RAW file'
77 "testCropSizeSigma"
78 "testFoveonFileOpenAndPostProcess"
79 "testThumbExtractBitmap"
80 ];
81
82 meta = {
83 description = "RAW image processing for Python, a wrapper for libraw";
84 homepage = "https://github.com/letmaik/rawpy";
85 license = with lib.licenses; [
86 lgpl21Only
87 mit
88 ];
89 maintainers = with lib.maintainers; [ GaetanLepage ];
90 };
91}