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