python310Packages.swspotify: disable platform detection and tests

This commit is contained in:
Fabian Affolter 2022-04-29 01:13:41 +02:00
parent 9f4d90d738
commit 5599116753

View file

@ -1,40 +1,57 @@
{ lib, stdenv, buildPythonPackage, fetchFromGitHub, requests { lib
, pytestCheckHook, flask, flask-cors, dbus-python, mock, isPy27 , stdenv
, poetry-core }: , buildPythonPackage
, dbus-python
, fetchFromGitHub
, flask
, flask-cors
, poetry-core
, pythonOlder
, requests
}:
buildPythonPackage rec { buildPythonPackage rec {
pname = "SwSpotify"; pname = "swspotify";
version = "1.2.3"; version = "1.2.3";
disabled = isPy27;
format = "pyproject"; format = "pyproject";
disabled = pythonOlder "3.6";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "SwagLyrics"; owner = "SwagLyrics";
repo = "SwSpotify"; repo = "SwSpotify";
rev = "v${version}"; rev = "v${version}";
sha256 = "sha256-xGLvc154xnje45Akf7H1qqQRUc03gGVt8AhGlkcP3kY="; hash = "sha256-xGLvc154xnje45Akf7H1qqQRUc03gGVt8AhGlkcP3kY=";
}; };
nativeBuildInputs = [ poetry-core ]; nativeBuildInputs = [
poetry-core
];
propagatedBuildInputs = [ requests flask flask-cors ] propagatedBuildInputs = [
++ lib.optionals stdenv.isLinux [ dbus-python ]; dbus-python
flask
flask-cors
requests
];
doCheck = !stdenv.isDarwin; postPatch = ''
# Detection of the platform doesn't always works with 1.2.3
checkPhase = '' substituteInPlace pyproject.toml \
pytest tests/test_spotify.py::${if stdenv.isDarwin then "DarwinTests" else "LinuxTests"} --replace 'dbus-python = {version = "^1.2.16", platform = "linux"}' ""
''; '';
checkInputs = [ pytestCheckHook mock ]; # Tests want to use Dbus
doCheck = false;
pythonImportsCheck = [ "SwSpotify" ]; pythonImportsCheck = [
"SwSpotify"
];
meta = with lib; { meta = with lib; {
homepage = "https://github.com/SwagLyrics/SwSpotify";
description = "Library to get the currently playing song and artist from Spotify"; description = "Library to get the currently playing song and artist from Spotify";
homepage = "https://github.com/SwagLyrics/SwSpotify";
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ siraben ]; maintainers = with maintainers; [ siraben ];
platforms = platforms.unix;
}; };
} }