2020-12-25 13:55:36 +00:00
|
|
|
{ buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2021-03-09 03:18:52 +00:00
|
|
|
, fetchpatch
|
2020-12-25 13:55:36 +00:00
|
|
|
, graphviz
|
2021-03-09 03:18:52 +00:00
|
|
|
, ifaddr
|
|
|
|
, isPy27
|
2020-12-25 13:55:36 +00:00
|
|
|
, lib
|
|
|
|
, mock
|
2021-03-09 03:18:52 +00:00
|
|
|
, nix-update-script
|
2020-12-25 13:55:36 +00:00
|
|
|
, pytestCheckHook
|
|
|
|
, requests
|
2021-03-09 03:18:52 +00:00
|
|
|
, requests-mock
|
2020-12-25 13:55:36 +00:00
|
|
|
, sphinx
|
2020-04-24 23:36:52 +00:00
|
|
|
, sphinx_rtd_theme
|
2020-12-25 13:55:36 +00:00
|
|
|
, toml
|
|
|
|
, xmltodict
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "soco";
|
2021-03-09 03:18:52 +00:00
|
|
|
version = "0.21.2";
|
|
|
|
disabled = isPy27;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
# N.B. We fetch from GitHub because the PyPI tarball doesn't contain the
|
|
|
|
# required files to run the tests.
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "SoCo";
|
|
|
|
repo = "SoCo";
|
|
|
|
rev = "v${version}";
|
2021-03-09 03:18:52 +00:00
|
|
|
sha256 = "sha256-CCgkzUkt9YqTJt9tPBLmYXW6ZuRoMDd7xahYmNXgfM0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-03-19 17:17:44 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://patch-diff.githubusercontent.com/raw/SoCo/SoCo/pull/811.patch";
|
|
|
|
sha256 = "sha256-GBd74c8zc25ROO411SZ9TTa+bi8yXJaaOQqY9FM1qj4=";
|
|
|
|
})
|
|
|
|
];
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
# N.B. These exist because:
|
|
|
|
# 1. Upstream's pinning isn't well maintained, leaving dependency versions no
|
|
|
|
# longer in nixpkgs.
|
|
|
|
# 2. There is no benefit for us to be running linting and coverage tests.
|
|
|
|
postPatch = ''
|
|
|
|
sed -i "/black/d" ./requirements-dev.txt
|
2021-03-09 03:18:52 +00:00
|
|
|
sed -i "/coveralls/d" ./requirements-dev.txt
|
|
|
|
sed -i "/flake8/d" ./requirements-dev.txt
|
2020-12-25 13:55:36 +00:00
|
|
|
sed -i "/pylint/d" ./requirements-dev.txt
|
|
|
|
sed -i "/pytest-cov/d" ./requirements-dev.txt
|
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2021-03-09 03:18:52 +00:00
|
|
|
ifaddr
|
2020-12-25 13:55:36 +00:00
|
|
|
requests
|
|
|
|
toml
|
|
|
|
xmltodict
|
|
|
|
];
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
checkInputs = [
|
2020-12-25 13:55:36 +00:00
|
|
|
pytestCheckHook
|
|
|
|
graphviz
|
|
|
|
mock
|
2021-03-09 03:18:52 +00:00
|
|
|
requests-mock
|
2020-12-25 13:55:36 +00:00
|
|
|
sphinx
|
2020-04-24 23:36:52 +00:00
|
|
|
sphinx_rtd_theme
|
|
|
|
];
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
passthru.updateScript = nix-update-script {
|
|
|
|
attrPath = "python3Packages.${pname}";
|
|
|
|
};
|
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://python-soco.com/";
|
|
|
|
description = "A CLI and library to control Sonos speakers";
|
2020-12-25 13:55:36 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ lovesegfault ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|