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