summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/usb-protocol/default.nix
blob: 00a93372fb3290da7a21cd94c3a2e21baed142f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
  lib,
  fetchFromGitHub,
  buildPythonPackage,

  # build-system
  setuptools,

  # dependencies
  construct,

  # tests
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "usb-protocol";
  version = "0.9.2";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "greatscottgadgets";
    repo = "python-usb-protocol";
    tag = version;
    hash = "sha256-lLepd2ja/UBSOARHXVwuCxLCIp0vTpUQBMdR2ovfhq8=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail '"setuptools-git-versioning<2"' "" \
      --replace-fail 'dynamic = ["version"]' 'version = "${version}"'
  '';

  build-system = [
    setuptools
  ];

  dependencies = [ construct ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  pythonImportsCheck = [
    "usb_protocol"
  ];

  meta = {
    changelog = "https://github.com/greatscottgadgets/python-usb-protocol/releases/tag/${src.tag}";
    description = "Python library providing utilities, data structures, constants, parsers, and tools for working with the USB protocol";
    homepage = "https://github.com/greatscottgadgets/python-usb-protocol";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ carlossless ];
  };
}