3p: fix ntfy

This commit is contained in:
Luke Granger-Brown 2023-12-14 11:17:59 +00:00
parent 3069e3d564
commit 5551d513c3
3 changed files with 67 additions and 0 deletions

View file

@ -26,6 +26,10 @@ let
}).overridePythonAttrs (oldAttrs: { }).overridePythonAttrs (oldAttrs: {
doCheck = false; doCheck = false;
checkPhase = ""; checkPhase = "";
patches = oldAttrs.patches ++ [
./ntfy-0001-Swap-from-inspect.getargspec-to-inspect.signature-fo.patch
./ntfy-0003-Swap-description-file-for-description_file-to-make-s.patch
];
}); });
delve = pkgs.delve.overrideAttrs (oldAttrs: { delve = pkgs.delve.overrideAttrs (oldAttrs: {
meta = oldAttrs.meta // { meta = oldAttrs.meta // {

View file

@ -0,0 +1,39 @@
From dc0ad61ece0a44123dbc34fe83b30a2c418caf8e Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <jj@lukegb.com>
Date: Sun, 19 Nov 2023 20:30:32 +0000
Subject: [PATCH 1/3] Swap from inspect.getargspec to inspect.signature for
Python 3.11+.
---
ntfy/__init__.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ntfy/__init__.py b/ntfy/__init__.py
index 13cb716..8449410 100644
--- a/ntfy/__init__.py
+++ b/ntfy/__init__.py
@@ -3,7 +3,7 @@ from getpass import getuser
from os import getcwd, path, name
from socket import gethostname
from importlib import import_module
-from inspect import getargspec
+from inspect import signature, Parameter
from .backends.default import DefaultNotifierError
__version__ = '2.7.1'
@@ -65,9 +65,9 @@ def notify(message, title, config=None, **kwargs):
notifier = e.module
e = e.exception
- args, _, _, defaults = getargspec(notifier.notify)
- possible_args = set(args)
- required_args = set(args) if defaults is None else set(args[:-len(defaults)])
+ signature = signature(notifier.notify)
+ possible_args = {arg.name for arg in signature.parameters.values()}
+ required_args = {arg.name for arg in signature.parameters.values() if arg.default == Parameter.empty}
required_args -= set(['title', 'message', 'retcode'])
unknown_args = set(backend_config) - possible_args
missing_args = required_args - set(backend_config)
--
2.42.0

View file

@ -0,0 +1,24 @@
From 3c19ff3fca2dd1555fd50b9ca3658947beb90e8a Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <jj@lukegb.com>
Date: Sun, 19 Nov 2023 20:30:32 +0000
Subject: [PATCH 3/3] Swap description-file for description_file to make
setuptools stop complaining.
---
setup.cfg | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.cfg b/setup.cfg
index 702d85a..3c4c300 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
[metadata]
-description-file = README.rst
+description_file = README.rst
[bdist_wheel]
universal = 1
--
2.42.0