1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
{
lib,
fetchFromGitHub,
buildPythonPackage,
# build-system
cython,
git,
pkgconfig,
setuptools,
setuptools-scm,
udevCheckHook,
# dependneices
numpy,
libusb-compat-0_1,
# optional-dependencies
pyusb,
# tests
mock,
pytestCheckHook,
zipp,
}:
## Usage
# In NixOS, add the package to services.udev.packages for non-root plugdev
# users to get device access permission:
# services.udev.packages = [ pkgs.python3Packages.seabreeze ];
buildPythonPackage rec {
pname = "seabreeze";
version = "2.11.0";
pyproject = true;
src = fetchFromGitHub {
owner = "ap--";
repo = "python-seabreeze";
tag = "v${version}";
hash = "sha256-PplymlXZlRt+BzhCzIYRMjr+rMFf+XfSq846QAlbRi0=";
leaveDotGit = true;
};
enableParallelBuilding = true;
postPatch = ''
# pkgconfig cant find libusb, doing it manually
substituteInPlace setup.py \
--replace-fail 'pkgconfig.parse("libusb")' \
"{'include_dirs': ['${libusb-compat-0_1}/include'], 'library_dirs': ['${libusb-compat-0_1}/lib'], 'libraries': ['usb']}"
'';
nativeBuildInputs = [
cython
git
pkgconfig
setuptools
setuptools-scm
udevCheckHook
];
propagatedBuildInputs = [
numpy
libusb-compat-0_1
];
optional-dependencies = {
pyseabreeze = [ pyusb ];
};
postInstall = ''
mkdir -p $out/etc/udev/rules.d
cp os_support/10-oceanoptics.rules $out/etc/udev/rules.d/10-oceanoptics.rules
'';
# few backends enabled, but still some tests
nativeCheckInputs = [
pytestCheckHook
mock
zipp
]
++ lib.concatAttrValues optional-dependencies;
disabledTests = [ "TestHardware" ];
setupPyBuildFlags = [ "--without-cseabreeze" ];
meta = {
homepage = "https://github.com/ap--/python-seabreeze";
description = "Python library to access Ocean Optics spectrometers";
maintainers = [ ];
license = lib.licenses.mit;
};
}
|