about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/cmsis-pack-manager/default.nix
blob: 6043f1c1556528252161bf94d35a631eb7c914db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{ lib
, fetchFromGitHub
, rustPlatform
, cffi
, libiconv
, stdenv
, darwin
, buildPythonPackage
, appdirs
, pyyaml
, hypothesis
, jinja2
, pytestCheckHook
, unzip
}:

buildPythonPackage rec {
  pname = "cmsis-pack-manager";
  version = "0.5.2";
  format = "pyproject";

  src = fetchFromGitHub {
    owner = "pyocd";
    repo = "cmsis-pack-manager";
    rev = "refs/tags/v${version}";
    hash = "sha256-PeyJf3TGUxv8/MKIQUgWrenrK4Hb+4cvtDA2h3r6kGg=";
  };

  cargoDeps = rustPlatform.fetchCargoTarball {
    inherit src;
    hash = "sha256-dO4qw5Jx0exwb4RuOhu6qvGxQZ+LayHtXDHZKADLTEI=";
  };

  nativeBuildInputs = [ rustPlatform.cargoSetupHook rustPlatform.maturinBuildHook ];
  propagatedNativeBuildInputs = [ cffi ];
  buildInputs = [ libiconv ]
    ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
  propagatedBuildInputs = [ appdirs pyyaml ];
  nativeCheckInputs = [ hypothesis jinja2 pytestCheckHook unzip ];

  # remove cmsis_pack_manager source directory so that binaries can be imported
  # from the installed wheel instead
  preCheck = ''
    rm -r cmsis_pack_manager
  '';

  disabledTests = [
    # All require DNS.
    "test_pull_pdscs"
    "test_install_pack"
    "test_pull_pdscs_cli"
    "test_dump_parts_cli"
  ];

  meta = with lib; {
    description = "A Rust and Python module for handling CMSIS Pack files";
    homepage = "https://github.com/pyocd/cmsis-pack-manager";
    license = licenses.asl20;
    maintainers = with maintainers; [ frogamic sbruder ];
  };
}