1{ lib
2, buildPythonPackage
3, fetchPypi
4, fetchpatch
5, capstone
6, cmsis-pack-manager
7, colorama
8, importlib-metadata
9, importlib-resources
10, intelhex
11, intervaltree
12, lark
13, natsort
14, prettytable
15, pyelftools
16, pylink-square
17, pyusb
18, pyyaml
19, setuptools
20, setuptools-scm
21, typing-extensions
22, stdenv
23, hidapi
24, pytestCheckHook
25}:
26
27buildPythonPackage rec {
28 pname = "pyocd";
29 version = "0.36.0";
30 pyproject = true;
31
32 src = fetchPypi {
33 inherit pname version;
34 hash = "sha256-k3eCrMna/wVNUPt8b3iM2UqE+A8LhfJarKuZ3Jgihkg=";
35 };
36
37 patches = [
38 # https://github.com/pyocd/pyOCD/pull/1332
39 (fetchpatch {
40 name = "libusb-package-optional.patch";
41 url = "https://github.com/pyocd/pyOCD/commit/0b980cf253e3714dd2eaf0bddeb7172d14089649.patch";
42 hash = "sha256-B2+50VntcQELeakJbCeJdgI1iBU+h2NkXqba+LRYa/0=";
43 })
44 ];
45
46 postPatch = ''
47 substituteInPlace setup.cfg \
48 --replace "libusb-package>=1.0,<2.0" ""
49 '';
50
51 nativeBuildInputs = [
52 setuptools
53 setuptools-scm
54 ];
55
56 propagatedBuildInputs = [
57 capstone
58 cmsis-pack-manager
59 colorama
60 importlib-metadata
61 importlib-resources
62 intelhex
63 intervaltree
64 lark
65 natsort
66 prettytable
67 pyelftools
68 pylink-square
69 pyusb
70 pyyaml
71 typing-extensions
72 ] ++ lib.optionals (!stdenv.isLinux) [
73 hidapi
74 ];
75
76 pythonImportsCheck = [
77 "pyocd"
78 ];
79
80 nativeCheckInputs = [
81 pytestCheckHook
82 ];
83
84 meta = with lib; {
85 changelog = "https://github.com/pyocd/pyOCD/releases/tag/v${version}";
86 description = "Python library for programming and debugging Arm Cortex-M microcontrollers";
87 downloadPage = "https://github.com/pyocd/pyOCD";
88 homepage = "https://pyocd.io";
89 license = licenses.asl20;
90 maintainers = with maintainers; [ frogamic sbruder ];
91 };
92}