1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, chardet
5, humanfriendly
6, pytestCheckHook
7, pythonOlder
8, setuptools-scm
9, smartmontools
10}:
11
12buildPythonPackage rec {
13 pname = "pysmart";
14 version = "1.3.0";
15 format = "pyproject";
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "truenas";
21 repo = "py-SMART";
22 rev = "refs/tags/v${version}";
23 hash = "sha256-1k+5XnIT/AfZmzKUxkyU/uc0eW05CvugpY6OdJCoALc=";
24 };
25
26 SETUPTOOLS_SCM_PRETEND_VERSION = version;
27
28 postPatch = ''
29 substituteInPlace pySMART/utils.py \
30 --replace "which('smartctl')" '"${smartmontools}/bin/smartctl"'
31 '';
32
33 propagatedBuildInputs = [
34 chardet
35 humanfriendly
36 ];
37
38 nativeBuildInputs = [
39 setuptools-scm
40 ];
41
42 nativeCheckInputs = [
43 pytestCheckHook
44 ];
45
46 pythonImportsCheck = [
47 "pySMART"
48 ];
49
50 meta = with lib; {
51 description = "Wrapper for smartctl (smartmontools)";
52 homepage = "https://github.com/truenas/py-SMART";
53 changelog = "https://github.com/truenas/py-SMART/blob/v${version}/CHANGELOG.md";
54 license = licenses.lgpl21Only;
55 maintainers = with maintainers; [ nyanloutre ];
56 };
57}