2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchPypi,
|
|
|
|
cffi,
|
|
|
|
py,
|
|
|
|
pytestCheckHook,
|
|
|
|
pyserial,
|
|
|
|
fetchpatch,
|
2020-11-09 15:59:12 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "smbus-cffi";
|
|
|
|
version = "0.5.1";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2020-11-09 15:59:12 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
|
|
|
sha256 = "fb4195aaabfc01586863f60d3190b5cb1bf8f12622fd597e23e48768dad6bde8";
|
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# https://github.com/bivab/smbus-cffi/pull/24
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/bivab/smbus-cffi/commit/ba79ae174a9d84e767d95f165c43ee212b1bbb92.patch";
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-WtRuK5y6fWDEhm0Xy5XqS5yCkn7vXXYtjlOjS90gla4=";
|
2020-11-09 15:59:12 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
propagatedNativeBuildInputs = [ cffi ];
|
|
|
|
|
2020-11-09 15:59:12 +00:00
|
|
|
propagatedBuildInputs = [ cffi ];
|
|
|
|
|
|
|
|
installCheckPhase = ''
|
|
|
|
# we want to import the installed module that also contains the compiled library
|
|
|
|
rm -rf smbus
|
|
|
|
runHook pytestCheckPhase
|
|
|
|
'';
|
|
|
|
|
|
|
|
# requires hardware access
|
|
|
|
pytestFlagsArray = [ "--ignore=test/test_smbus_integration.py" ];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
py
|
|
|
|
pytestCheckHook
|
|
|
|
pyserial
|
|
|
|
];
|
2020-11-09 15:59:12 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python module for SMBus access through Linux I2C /dev interface";
|
|
|
|
homepage = "https://github.com/bivab/smbus-cffi";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ mic92 ];
|
2021-01-09 10:05:03 +00:00
|
|
|
platforms = platforms.linux;
|
2020-11-09 15:59:12 +00:00
|
|
|
};
|
|
|
|
}
|