1{
2 lib,
3 async-timeout,
4 buildPythonPackage,
5 fetchFromGitHub,
6 webcolors,
7 pythonOlder,
8 pytestCheckHook,
9 setuptools,
10}:
11
12buildPythonPackage rec {
13 pname = "flux-led";
14 version = "1.0.4";
15 pyproject = true;
16
17 disabled = pythonOlder "3.8";
18
19 src = fetchFromGitHub {
20 owner = "Danielhiversen";
21 repo = "flux_led";
22 rev = "refs/tags/${version}";
23 hash = "sha256-enYo2hZ1C8jqO+8xZhSmIOJQAyrtVUJ9S/e2Bxzhv0I=";
24 };
25
26 postPatch = ''
27 substituteInPlace setup.py \
28 --replace-fail '"pytest-runner>=5.2",' ""
29 # webcolors API change, https://github.com/Danielhiversen/flux_led/issues/401
30 substituteInPlace flux_led/utils.py \
31 --replace-fail "CSS2_HEX_TO_NAMES.values()" 'names("css2")' \
32 --replace-fail "CSS21_HEX_TO_NAMES.values()" 'names("css21")' \
33 --replace-fail "CSS3_HEX_TO_NAMES.values()" 'names("css3")' \
34 --replace-fail "HTML4_HEX_TO_NAMES.values()" 'names("html4")'
35 '';
36
37 build-system = [ setuptools ];
38
39 dependencies = [
40 async-timeout
41 webcolors
42 ];
43
44 nativeCheckInputs = [ pytestCheckHook ];
45
46 pytestFlagsArray = [ "tests.py" ];
47
48 pythonImportsCheck = [ "flux_led" ];
49
50 # disabledTests = [
51 # # AttributeError: module 'webcolors' has no attribute 'CSS2_HEX_TO_NAMES'
52 # "test_get_color_names_list"
53 # ];
54
55 meta = with lib; {
56 description = "Python library to communicate with the flux_led smart bulbs";
57 homepage = "https://github.com/Danielhiversen/flux_led";
58 changelog = "https://github.com/Danielhiversen/flux_led/releases/tag/${version}";
59 license = licenses.lgpl3Plus;
60 maintainers = with maintainers; [ colemickens ];
61 platforms = platforms.linux;
62 mainProgram = "flux_led";
63 };
64}