summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/stm32loader/default.nix
blob: 83811663bcd1b596960ced42cad1c227922b3b1e (plain)
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
62
63
64
65
66
{
  lib,
  buildPythonPackage,
  fetchPypi,
  fetchpatch2,

  # build-system
  flit-core,

  # dependencies
  progress,
  pyserial,

  # optional-dependencies
  intelhex,

  # tests
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "stm32loader";
  version = "0.7.1";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-QTLSEjdJtDH4GCamnKHN5pEjW41rRtAMXxyZZMM5K3w=";
  };

  patches = [
    # fix build with python 3.12
    # https://github.com/florisla/stm32loader/pull/79
    (fetchpatch2 {
      url = "https://github.com/florisla/stm32loader/commit/96f59b2984b0d0371b2da0360d6e8d94d0b39a68.patch?full_index=1";
      hash = "sha256-JUEjQWOnzeMA1OELS214OR7+MYUkCKN5lxwsmRoFbfo=";
    })
  ];

  nativeBuildInputs = [ flit-core ];

  propagatedBuildInputs = [
    progress
    pyserial
  ];

  optional-dependencies = {
    hex = [ intelhex ];
  };

  nativeCheckInputs = [
    pytestCheckHook
  ]
  ++ lib.concatAttrValues optional-dependencies;

  enabledTestPaths = [ "tests/unit" ];

  meta = {
    description = "Flash firmware to STM32 microcontrollers in Python";
    mainProgram = "stm32loader";
    homepage = "https://github.com/florisla/stm32loader";
    changelog = "https://github.com/florisla/stm32loader/blob/v${version}/CHANGELOG.md";
    license = lib.licenses.gpl3;
    maintainers = [ ];
  };
}