1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 amaranth,
11 apollo-fpga,
12 libusb1,
13 luna-soc,
14 luna-usb,
15 prompt-toolkit,
16 pyfwup,
17 pygreat,
18 pyserial,
19 pyusb,
20 tabulate,
21 tomli,
22 tqdm,
23
24 # tests
25 pytestCheckHook,
26}:
27buildPythonPackage rec {
28 pname = "cynthion";
29 version = "0.2.2";
30 pyproject = true;
31
32 src = fetchFromGitHub {
33 owner = "greatscottgadgets";
34 repo = "cynthion";
35 tag = version;
36 hash = "sha256-xL1/ckX+xKUQpugQkLB3SlZeNcBEaTMascTgoQ4C+hA=";
37 };
38
39 sourceRoot = "${src.name}/cynthion/python";
40
41 postPatch = ''
42 substituteInPlace pyproject.toml \
43 --replace-fail '"setuptools-git-versioning<2"' "" \
44 --replace-fail 'dynamic = ["version"]' 'version = "${version}"'
45 '';
46
47 build-system = [
48 setuptools
49 ];
50
51 pythonRemoveDeps = [ "future" ];
52
53 dependencies = [
54 amaranth
55 apollo-fpga
56 libusb1
57 luna-soc
58 luna-usb
59 prompt-toolkit
60 pyfwup
61 pygreat
62 pyserial
63 pyusb
64 tabulate
65 tomli
66 tqdm
67 ];
68
69 nativeCheckInputs = [
70 pytestCheckHook
71 ];
72
73 pythonImportsCheck = [ "cynthion" ];
74
75 meta = {
76 description = "Python package and utilities for the Great Scott Gadgets Cynthion USB Test Instrument";
77 homepage = "https://github.com/greatscottgadgets/cynthion";
78 changelog = "https://github.com/greatscottgadgets/cynthion/releases/tag/${src.tag}";
79 license = lib.licenses.bsd3;
80 maintainers = with lib.maintainers; [ carlossless ];
81 };
82}