From 5551d513c35881d4dbe699d0cf0cb6169b54a71e Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Thu, 14 Dec 2023 11:17:59 +0000 Subject: [PATCH] 3p: fix ntfy --- third_party/default.nix | 4 ++ ...t.getargspec-to-inspect.signature-fo.patch | 39 +++++++++++++++++++ ...-file-for-description_file-to-make-s.patch | 24 ++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 third_party/ntfy-0001-Swap-from-inspect.getargspec-to-inspect.signature-fo.patch create mode 100644 third_party/ntfy-0003-Swap-description-file-for-description_file-to-make-s.patch diff --git a/third_party/default.nix b/third_party/default.nix index 320207a965..59d84404d6 100644 --- a/third_party/default.nix +++ b/third_party/default.nix @@ -26,6 +26,10 @@ let }).overridePythonAttrs (oldAttrs: { doCheck = false; 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: { meta = oldAttrs.meta // { diff --git a/third_party/ntfy-0001-Swap-from-inspect.getargspec-to-inspect.signature-fo.patch b/third_party/ntfy-0001-Swap-from-inspect.getargspec-to-inspect.signature-fo.patch new file mode 100644 index 0000000000..63b8aaf1b0 --- /dev/null +++ b/third_party/ntfy-0001-Swap-from-inspect.getargspec-to-inspect.signature-fo.patch @@ -0,0 +1,39 @@ +From dc0ad61ece0a44123dbc34fe83b30a2c418caf8e Mon Sep 17 00:00:00 2001 +From: Luke Granger-Brown +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 + diff --git a/third_party/ntfy-0003-Swap-description-file-for-description_file-to-make-s.patch b/third_party/ntfy-0003-Swap-description-file-for-description_file-to-make-s.patch new file mode 100644 index 0000000000..4abc6fafcd --- /dev/null +++ b/third_party/ntfy-0003-Swap-description-file-for-description_file-to-make-s.patch @@ -0,0 +1,24 @@ +From 3c19ff3fca2dd1555fd50b9ca3658947beb90e8a Mon Sep 17 00:00:00 2001 +From: Luke Granger-Brown +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 +