1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 pythonOlder,
7 future,
8 pyusb,
9}:
10
11buildPythonPackage rec {
12 pname = "pygreat";
13 version = "2024.0.3";
14 pyproject = true;
15 disabled = pythonOlder "3.8";
16
17 src = fetchFromGitHub {
18 owner = "greatscottgadgets";
19 repo = "libgreat";
20 tag = "v${version}";
21 hash = "sha256-dJqL85mx1zGYUpMxDa83hNRr7eUn5NNfWXullGFQK70=";
22 };
23
24 sourceRoot = "${src.name}/host";
25
26 postPatch = ''
27 substituteInPlace pyproject.toml \
28 --replace-fail '"setuptools-git-versioning<2"' "" \
29 --replace-fail 'dynamic = ["version"]' 'version = "${version}"'
30 '';
31
32 build-system = [
33 setuptools
34 ];
35
36 pythonRemoveDeps = [
37 "backports.functools_lru_cache"
38 ];
39
40 dependencies = [
41 future
42 pyusb
43 ];
44
45 # has no tests
46 doCheck = false;
47
48 pythonImportsCheck = [
49 "pygreat"
50 ];
51
52 meta = {
53 changelog = "https://github.com/greatscottgadgets/libgreat/releases/tag/v${version}";
54 description = "Python library for talking with libGreat devices";
55 homepage = "https://github.com/greatscottgadgets/libgreat/";
56 license = with lib.licenses; [ bsd3 ];
57 maintainers = with lib.maintainers; [ carlossless ];
58 };
59}