1{
2 lib,
3 fetchFromGitHub,
4 rustPlatform,
5 cffi,
6 libiconv,
7 stdenv,
8 darwin,
9 buildPythonPackage,
10 appdirs,
11 pyyaml,
12 hypothesis,
13 jinja2,
14 pytestCheckHook,
15 unzip,
16}:
17
18buildPythonPackage rec {
19 pname = "cmsis-pack-manager";
20 version = "0.5.2";
21 format = "pyproject";
22
23 src = fetchFromGitHub {
24 owner = "pyocd";
25 repo = "cmsis-pack-manager";
26 rev = "refs/tags/v${version}";
27 hash = "sha256-PeyJf3TGUxv8/MKIQUgWrenrK4Hb+4cvtDA2h3r6kGg=";
28 };
29
30 cargoDeps = rustPlatform.fetchCargoTarball {
31 inherit src;
32 hash = "sha256-dO4qw5Jx0exwb4RuOhu6qvGxQZ+LayHtXDHZKADLTEI=";
33 };
34
35 nativeBuildInputs = [
36 rustPlatform.cargoSetupHook
37 rustPlatform.maturinBuildHook
38 ];
39 propagatedNativeBuildInputs = [ cffi ];
40 buildInputs = [
41 libiconv
42 ] ++ lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.Security;
43 propagatedBuildInputs = [
44 appdirs
45 pyyaml
46 ];
47 nativeCheckInputs = [
48 hypothesis
49 jinja2
50 pytestCheckHook
51 unzip
52 ];
53
54 # remove cmsis_pack_manager source directory so that binaries can be imported
55 # from the installed wheel instead
56 preCheck = ''
57 rm -r cmsis_pack_manager
58 '';
59
60 disabledTests = [
61 # All require DNS.
62 "test_pull_pdscs"
63 "test_install_pack"
64 "test_pull_pdscs_cli"
65 "test_dump_parts_cli"
66 ];
67
68 meta = with lib; {
69 description = "Rust and Python module for handling CMSIS Pack files";
70 homepage = "https://github.com/pyocd/cmsis-pack-manager";
71 license = licenses.asl20;
72 maintainers = with maintainers; [
73 frogamic
74 sbruder
75 ];
76 };
77}