python310Packages.notify-py: 0.3.3 -> 0.3.38

https://github.com/ms7m/notify-py/releases/tag/v0.3.38
This commit is contained in:
Robert Schütz 2022-12-09 22:48:32 -08:00 committed by Robert Schütz
parent 7bbdd67dee
commit df429dc647
2 changed files with 37 additions and 52 deletions

View file

@ -1,12 +1,14 @@
{ lib
, stdenv
, buildPythonPackage
, isPy3k
, pythonOlder
, fetchFromGitHub
, substituteAll
, alsa-utils
, libnotify
, which
, poetry-core
, pythonRelaxDepsHook
, jeepney
, loguru
, pytest
@ -16,15 +18,17 @@
buildPythonPackage rec {
pname = "notify-py";
version = "0.3.3";
version = "0.3.38";
disabled = !isPy3k;
disabled = pythonOlder "3.6";
format = "pyproject";
src = fetchFromGitHub {
owner = "ms7m";
repo = pname;
rev = "v${version}";
sha256 = "1n35adwsyhz304n4ifnsz6qzkymwhyqc8sg8d76qv5psv2xsnzlf";
hash = "sha256-wlA7a10f4PYP3dYYwZqMULQ5FMCXpOUOTxXzEEVZCsI=";
};
patches = lib.optionals stdenv.isLinux [
@ -42,6 +46,15 @@ buildPythonPackage rec {
})
];
nativeBuildInputs = [
poetry-core
pythonRelaxDepsHook
];
pythonRelaxDeps = [
"loguru"
];
propagatedBuildInputs = [
loguru
] ++ lib.optionals stdenv.isLinux [
@ -67,6 +80,10 @@ buildPythonPackage rec {
pytest
'';
# GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name
# org.freedesktop.Notifications was not provided by any .service files
doCheck = false;
pythonImportsCheck = [ "notifypy" ];
meta = with lib; {

View file

@ -1,54 +1,22 @@
diff --git a/notifypy/os_notifiers/linux.py b/notifypy/os_notifiers/linux.py
index ee89216..5201574 100644
index 5882481..e26eaaf 100644
--- a/notifypy/os_notifiers/linux.py
+++ b/notifypy/os_notifiers/linux.py
@@ -53,30 +53,12 @@ class LinuxNotifierLibNotify(BaseNotifier):
@staticmethod
def _find_installed_aplay():
"""Function to find the path for notify-send"""
- try:
- run_which_for_aplay = subprocess.check_output(["which", "aplay"])
- return run_which_for_aplay.decode("utf-8")
- except subprocess.CalledProcessError:
- logger.exception("Unable to find aplay.")
- return False
- except Exception:
- logger.exception("Unhandled exception for finding aplay.")
- return False
+ return "@aplay@"
@@ -10,7 +10,7 @@ try:
from jeepney.io.blocking import open_dbus_connection
from shutil import which
@staticmethod
def _find_installed_notify_send():
"""Function to find the path for notify-send"""
- try:
- run_which_for_notify_send = subprocess.check_output(
- ["which", "notify-send"]
- )
- return run_which_for_notify_send.decode("utf-8")
- except subprocess.CalledProcessError:
- logger.exception("Unable to find notify-send.")
- return False
- except Exception:
- logger.exception("Unhandled exception for finding notify-send.")
- return False
+ return "@notifysend@"
- NOTIFY = which('notify-send') # alternatively: from ctypes.util import find_library
+ NOTIFY = '@notifysend@' # alternatively: from ctypes.util import find_library
def send_notification(
self,
@@ -159,15 +141,7 @@ class LinuxNotifier(BaseNotifier):
@staticmethod
def _find_installed_aplay():
"""Function to find the path for notify-send"""
- try:
- run_which_for_aplay = subprocess.check_output(["which", "aplay"])
- return run_which_for_aplay.decode("utf-8")
- except subprocess.CalledProcessError:
- logger.exception("Unable to find aplay.")
- return False
- except Exception:
- logger.exception("Unhandled exception for finding aplay.")
- return False
+ return "@aplay@"
if NOTIFY:
logger.info("libnotify found, using it for notifications")
@@ -22,7 +22,7 @@ try:
else:
raise ImportError
def send_notification(
self,
- APLAY = which('aplay')
+ APLAY = '@aplay@'
if APLAY == None:
logger.debug("aplay binary not installed.. audio will not work!")