1{ lib
2, buildPythonPackage
3, fetchPypi
4, cffi
5, py
6, pytestCheckHook
7, pyserial
8, fetchpatch
9}:
10
11buildPythonPackage rec {
12 pname = "smbus-cffi";
13 version = "0.5.1";
14
15 src = fetchPypi {
16 inherit pname version;
17 sha256 = "fb4195aaabfc01586863f60d3190b5cb1bf8f12622fd597e23e48768dad6bde8";
18 };
19
20 patches = [
21 # https://github.com/bivab/smbus-cffi/pull/24
22 (fetchpatch {
23 url = "https://github.com/bivab/smbus-cffi/commit/ba79ae174a9d84e767d95f165c43ee212b1bbb92.patch";
24 hash = "sha256-WtRuK5y6fWDEhm0Xy5XqS5yCkn7vXXYtjlOjS90gla4=";
25 })
26 ];
27
28 propagatedNativeBuildInputs = [ cffi ];
29
30 propagatedBuildInputs = [ cffi ];
31
32 installCheckPhase = ''
33 # we want to import the installed module that also contains the compiled library
34 rm -rf smbus
35 runHook pytestCheckPhase
36 '';
37
38 # requires hardware access
39 pytestFlagsArray = [ "--ignore=test/test_smbus_integration.py" ];
40
41 nativeCheckInputs = [ py pytestCheckHook pyserial ];
42
43 meta = with lib; {
44 description = "Python module for SMBus access through Linux I2C /dev interface";
45 homepage = "https://github.com/bivab/smbus-cffi";
46 license = licenses.gpl2;
47 maintainers = with maintainers; [ mic92 ];
48 platforms = platforms.linux;
49 };
50}