1{ lib
2, buildPythonPackage
3, fetchPypi
4, pkgs
5, setuptools
6, aiofiles
7, click
8, coverage
9, tomli
10, pytest
11, pytest-mock
12, pytest-asyncio
13, pytestCheckHook
14, pythonOlder
15}:
16buildPythonPackage rec {
17 pname = "w1thermsensor";
18 version = "2.0.0";
19 format = "pyproject";
20
21 src = fetchPypi {
22 inherit pname version;
23 hash = "sha256-EcaEr4B8icbwZu2Ty3z8AAgglf74iZ5BLpLnSOZC2cE=";
24 };
25
26 postPatch = ''
27 sed -i 's/3\.5\.\*/3.5/' setup.py
28 '';
29
30 nativeBuildInputs = [
31 setuptools
32 ];
33
34 propagatedBuildInputs = [
35 aiofiles
36 click
37 ];
38
39 # Don't try to load the kernel module in tests.
40 env.W1THERMSENSOR_NO_KERNEL_MODULE = 1;
41
42 nativeCheckInputs = [
43 pytest-mock
44 pytest-asyncio
45 pytestCheckHook
46 ] ++ lib.optionals (pythonOlder "3.11") [
47 tomli
48 ];
49
50 # Tests for 2.0.0 currently fail on python3.11
51 # https://github.com/timofurrer/w1thermsensor/issues/116
52 doCheck = pythonOlder "3.11";
53
54 pythonImportsCheck = [
55 "w1thermsensor"
56 ];
57
58 meta = with lib; {
59 description = "Python interface to 1-Wire temperature sensors";
60 longDescription = ''
61 A Python package and CLI tool to work with w1 temperature sensors like
62 DS1822, DS18S20 & DS18B20 on the Raspberry Pi, Beagle Bone and other
63 devices.
64 '';
65 homepage = "https://github.com/timofurrer/w1thermsensor";
66 license = licenses.mit;
67 maintainers = with maintainers; [ quentin ];
68 platforms = platforms.all;
69 };
70}