1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 fetchpatch2,
6
7 # build-system
8 flit-core,
9
10 # dependencies
11 progress,
12 pyserial,
13
14 # optional-dependencies
15 intelhex,
16
17 # tests
18 pytestCheckHook,
19}:
20
21buildPythonPackage rec {
22 pname = "stm32loader";
23 version = "0.7.1";
24 pyproject = true;
25
26 src = fetchPypi {
27 inherit pname version;
28 hash = "sha256-QTLSEjdJtDH4GCamnKHN5pEjW41rRtAMXxyZZMM5K3w=";
29 };
30
31 patches = [
32 # fix build with python 3.12
33 # https://github.com/florisla/stm32loader/pull/79
34 (fetchpatch2 {
35 url = "https://github.com/florisla/stm32loader/commit/96f59b2984b0d0371b2da0360d6e8d94d0b39a68.patch?full_index=1";
36 hash = "sha256-JUEjQWOnzeMA1OELS214OR7+MYUkCKN5lxwsmRoFbfo=";
37 })
38 ];
39
40 nativeBuildInputs = [ flit-core ];
41
42 propagatedBuildInputs = [
43 progress
44 pyserial
45 ];
46
47 optional-dependencies = {
48 hex = [ intelhex ];
49 };
50
51 nativeCheckInputs = [
52 pytestCheckHook
53 ] ++ lib.flatten (lib.attrValues optional-dependencies);
54
55 pytestFlagsArray = [ "tests/unit" ];
56
57 meta = with lib; {
58 description = "Flash firmware to STM32 microcontrollers in Python";
59 mainProgram = "stm32loader";
60 homepage = "https://github.com/florisla/stm32loader";
61 changelog = "https://github.com/florisla/stm32loader/blob/v${version}/CHANGELOG.md";
62 license = licenses.gpl3;
63 maintainers = [ ];
64 };
65}