1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5
6 # build-system
7 hatchling,
8 hatch-vcs,
9
10 # dependencies
11 pyudev,
12}:
13
14buildPythonPackage rec {
15 pname = "rtslib-fb";
16 version = "2.2.2";
17 pyproject = true;
18
19 # TypeError: 'method' object does not support the context manager protocol
20 postPatch = ''
21 substituteInPlace rtslib/root.py \
22 --replace-fail "Path(restore_file).open" "Path(restore_file).open('r')"
23 '';
24
25 src = fetchFromGitHub {
26 owner = "open-iscsi";
27 repo = "rtslib-fb";
28 tag = "v${version}";
29 hash = "sha256-FuXO/yGZBR+QRvB5s1tE77hjnisSfjjHSCPLvGJOYdM=";
30 };
31
32 build-system = [
33 hatchling
34 hatch-vcs
35 ];
36
37 dependencies = [
38 pyudev
39 ];
40
41 postInstall = ''
42 install -Dm555 scripts/targetctl -t $out/bin
43 '';
44
45 # No tests
46 doCheck = false;
47
48 meta = {
49 description = "Python object API for managing the Linux LIO kernel target";
50 homepage = "https://github.com/open-iscsi/rtslib-fb";
51 changelog = "https://github.com/open-iscsi/rtslib-fb/releases/tag/v${version}";
52 license = lib.licenses.asl20;
53 platforms = lib.platforms.linux;
54 mainProgram = "targetctl";
55 };
56}