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