Merge pull request #120289 from austinbutler/notifypy-darwin

python3Packages.notify-py: fix build on Darwin
This commit is contained in:
Luke Granger-Brown 2021-06-04 16:11:56 +01:00 committed by GitHub
commit 9232abe031
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 46 deletions

View file

@ -1,33 +1,37 @@
{ lib, buildPythonPackage, fetchPypi, isPy3k, alsaUtils, libnotify, which, loguru, pytest }:
{ lib, stdenv, buildPythonPackage, fetchFromGitHub, isPy3k, coreutils, alsaUtils
, libnotify, which, jeepney, loguru, pytestCheckHook }:
buildPythonPackage rec {
pname = "notify_py";
version = "0.3.1";
pname = "notify-py";
version = "0.3.3";
disabled = !isPy3k;
src = fetchPypi {
inherit pname version;
sha256 = "5ba696d18ffe1d7070f3d0a5b4923fee4d6c863de6843af105bec0ce9915ebad";
src = fetchFromGitHub {
owner = "ms7m";
repo = pname;
rev = "v${version}";
sha256 = "1n35adwsyhz304n4ifnsz6qzkymwhyqc8sg8d76qv5psv2xsnzlf";
};
postPatch = ''
substituteInPlace setup.py \
--replace "loguru==0.4.1" "loguru~=0.5.0"
'';
propagatedNativeBuildInputs = [ which ]
++ lib.optionals stdenv.isLinux [ alsaUtils libnotify ];
propagatedBuildInputs = [ loguru ]
++ lib.optionals stdenv.isLinux [ jeepney ];
propagatedBuildInputs = [ alsaUtils libnotify loguru which ];
checkInputs = [ coreutils pytestCheckHook ];
checkInputs = [ alsaUtils libnotify pytest which ];
checkPhase = ''
pytest
# Tests search for "afplay" binary which is built in to MacOS and not available in nixpkgs
preCheck = ''
mkdir $TMP/bin
ln -s ${coreutils}/bin/true $TMP/bin/afplay
export PATH="$TMP/bin:$PATH"
'';
pythonImportsCheck = [ "notifypy" ];
meta = with lib; {
description = " Python Module for sending cross-platform desktop notifications on Windows, macOS, and Linux.";
description = "Python Module for sending cross-platform desktop notifications on Windows, macOS, and Linux.";
homepage = "https://github.com/ms7m/notify-py/";
license = licenses.mit;
maintainers = with maintainers; [ austinbutler ];

View file

@ -1,41 +1,26 @@
{ lib, buildPythonPackage, fetchPypi, pythonAtLeast, pythonOlder
, click
, click-completion
, factory_boy
, faker
, inquirer
, notify-py
, pbr
, pendulum
, ptable
, pytest
, pytestcov
, pytest-mock
, requests
, twine
, validate-email
}:
{ lib, buildPythonPackage, fetchPypi, pythonAtLeast, pythonOlder, click
, click-completion, factory_boy, faker, inquirer, notify-py, pbr, pendulum
, ptable, pytestCheckHook, pytestcov, pytest-mock, requests, twine
, validate-email }:
buildPythonPackage rec {
pname = "toggl-cli";
version = "2.4.1";
version = "2.4.2";
disabled = pythonOlder "3.5";
src = fetchPypi {
pname = "togglCli";
inherit version;
sha256 = "19lry8adcznzmzbvghyid3yl4j05db6931bw38af5vrkkyzyf62i";
sha256 = "1wgh231r16jyvaj1ch1pajvl9szflb4srs505pfdwdlqvz7rzww8";
};
postPatch = ''
substituteInPlace requirements.txt \
--replace "inquirer==2.6.3" "inquirer>=2.6.3" \
--replace "notify-py==0.2.2" "notify-py>=0.2.2"
--replace "notify-py==0.3.1" "notify-py>=0.3.1"
'';
nativeBuildInputs = [ pbr twine ];
checkInputs = [ pbr pytest pytestcov pytest-mock faker factory_boy ];
checkInputs = [ pbr pytestCheckHook pytestcov pytest-mock faker factory_boy ];
preCheck = ''
export TOGGL_API_TOKEN=your_api_token
@ -43,11 +28,13 @@ buildPythonPackage rec {
export TOGGL_USERNAME=user@example.com
'';
checkPhase = ''
runHook preCheck
pytest -k "not premium and not TestDateTimeType and not TestDateTimeField" tests/unit --maxfail=20
runHook postCheck
'';
disabledTests = [
"integration"
"premium"
"test_parsing"
"test_type_check"
"test_now"
];
propagatedBuildInputs = [
click