Merge pull request #119126 from fabaff/pycomfoconnect
[NixPkgs.git] / pkgs / development / python-modules / soco / default.nix
bloba72c413c1860dd2128ef6c4448637ded345001c0
1 { buildPythonPackage
2 , fetchFromGitHub
3 , fetchpatch
4 , graphviz
5 , ifaddr
6 , isPy27
7 , lib
8 , mock
9 , nix-update-script
10 , pytestCheckHook
11 , requests
12 , requests-mock
13 , sphinx
14 , sphinx_rtd_theme
15 , toml
16 , xmltodict
19 buildPythonPackage rec {
20   pname = "soco";
21   version = "0.21.2";
22   disabled = isPy27;
24   # N.B. We fetch from GitHub because the PyPI tarball doesn't contain the
25   # required files to run the tests.
26   src = fetchFromGitHub {
27     owner = "SoCo";
28     repo = "SoCo";
29     rev = "v${version}";
30     sha256 = "sha256-CCgkzUkt9YqTJt9tPBLmYXW6ZuRoMDd7xahYmNXgfM0=";
31   };
33   patches = [
34     (fetchpatch {
35       url = "https://patch-diff.githubusercontent.com/raw/SoCo/SoCo/pull/811.patch";
36       sha256 = "sha256-GBd74c8zc25ROO411SZ9TTa+bi8yXJaaOQqY9FM1qj4=";
37     })
38   ];
40   # N.B. These exist because:
41   # 1. Upstream's pinning isn't well maintained, leaving dependency versions no
42   #    longer in nixpkgs.
43   # 2. There is no benefit for us to be running linting and coverage tests.
44   postPatch = ''
45     sed -i "/black/d" ./requirements-dev.txt
46     sed -i "/coveralls/d" ./requirements-dev.txt
47     sed -i "/flake8/d" ./requirements-dev.txt
48     sed -i "/pylint/d" ./requirements-dev.txt
49     sed -i "/pytest-cov/d" ./requirements-dev.txt
50   '';
52   propagatedBuildInputs = [
53     ifaddr
54     requests
55     toml
56     xmltodict
57   ];
59   checkInputs = [
60     pytestCheckHook
61     graphviz
62     mock
63     requests-mock
64     sphinx
65     sphinx_rtd_theme
66   ];
68   passthru.updateScript = nix-update-script {
69     attrPath = "python3Packages.${pname}";
70   };
72   meta = with lib; {
73     homepage = "http://python-soco.com/";
74     description = "A CLI and library to control Sonos speakers";
75     license = licenses.mit;
76     maintainers = with maintainers; [ lovesegfault ];
77   };