1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 pythonOlder,
6
7 # build-system
8 setuptools,
9
10 # dependencies
11 construct,
12
13 # tests
14 pytestCheckHook,
15}:
16
17buildPythonPackage rec {
18 pname = "usb-protocol";
19 version = "0.9.2";
20 pyproject = true;
21 disabled = pythonOlder "3.8";
22
23 src = fetchFromGitHub {
24 owner = "greatscottgadgets";
25 repo = "python-usb-protocol";
26 tag = version;
27 hash = "sha256-lLepd2ja/UBSOARHXVwuCxLCIp0vTpUQBMdR2ovfhq8=";
28 };
29
30 postPatch = ''
31 substituteInPlace pyproject.toml \
32 --replace-fail '"setuptools-git-versioning<2"' "" \
33 --replace-fail 'dynamic = ["version"]' 'version = "${version}"'
34 '';
35
36 build-system = [
37 setuptools
38 ];
39
40 dependencies = [ construct ];
41
42 nativeCheckInputs = [
43 pytestCheckHook
44 ];
45
46 pythonImportsCheck = [
47 "usb_protocol"
48 ];
49
50 meta = {
51 changelog = "https://github.com/greatscottgadgets/python-usb-protocol/releases/tag/${src.tag}";
52 description = "Python library providing utilities, data structures, constants, parsers, and tools for working with the USB protocol";
53 homepage = "https://github.com/greatscottgadgets/python-usb-protocol";
54 license = lib.licenses.bsd3;
55 maintainers = with lib.maintainers; [ carlossless ];
56 };
57}