1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 setuptools-scm,
9
10 # dependencies
11 capstone,
12 cmsis-pack-manager,
13 colorama,
14 importlib-metadata,
15 importlib-resources,
16 intelhex,
17 intervaltree,
18 lark,
19 natsort,
20 prettytable,
21 pyelftools,
22 pylink-square,
23 pyusb,
24 pyyaml,
25 typing-extensions,
26 hidapi,
27
28 # tests
29 pytestCheckHook,
30}:
31
32buildPythonPackage rec {
33 pname = "pyocd";
34 version = "0.39.0";
35 pyproject = true;
36
37 src = fetchFromGitHub {
38 owner = "pyocd";
39 repo = "pyOCD";
40 tag = "v${version}";
41 hash = "sha256-/jFH6h8RmLupSyzf4mXNzhfbuAAfqkfWFSfQmGMVDRE=";
42 };
43
44 pythonRelaxDeps = [ "capstone" ];
45 pythonRemoveDeps = [ "libusb-package" ];
46
47 build-system = [ setuptools-scm ];
48
49 dependencies = [
50 capstone
51 cmsis-pack-manager
52 colorama
53 importlib-metadata
54 importlib-resources
55 intelhex
56 intervaltree
57 lark
58 natsort
59 prettytable
60 pyelftools
61 pylink-square
62 pyusb
63 pyyaml
64 typing-extensions
65 ]
66 ++ lib.optionals (!stdenv.hostPlatform.isLinux) [ hidapi ];
67
68 pythonImportsCheck = [ "pyocd" ];
69
70 disabledTests = [
71 # AttributeError: 'not_called' is not a valid assertion
72 # Upstream fix at https://github.com/pyocd/pyOCD/pull/1710
73 "test_transfer_err_not_flushed"
74 ];
75
76 nativeCheckInputs = [ pytestCheckHook ];
77
78 meta = {
79 changelog = "https://github.com/pyocd/pyOCD/releases/tag/${src.tag}";
80 description = "Python library for programming and debugging Arm Cortex-M microcontrollers";
81 downloadPage = "https://github.com/pyocd/pyOCD";
82 homepage = "https://pyocd.io";
83 license = lib.licenses.asl20;
84 maintainers = with lib.maintainers; [
85 frogamic
86 sbruder
87 ];
88 };
89}