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 = [ libiconv ] ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
41 propagatedBuildInputs = [
42 appdirs
43 pyyaml
44 ];
45 nativeCheckInputs = [
46 hypothesis
47 jinja2
48 pytestCheckHook
49 unzip
50 ];
51
52 # remove cmsis_pack_manager source directory so that binaries can be imported
53 # from the installed wheel instead
54 preCheck = ''
55 rm -r cmsis_pack_manager
56 '';
57
58 disabledTests = [
59 # All require DNS.
60 "test_pull_pdscs"
61 "test_install_pack"
62 "test_pull_pdscs_cli"
63 "test_dump_parts_cli"
64 ];
65
66 meta = with lib; {
67 description = "A Rust and Python module for handling CMSIS Pack files";
68 homepage = "https://github.com/pyocd/cmsis-pack-manager";
69 license = licenses.asl20;
70 maintainers = with maintainers; [
71 frogamic
72 sbruder
73 ];
74 };
75}