Merge pull request #192804 from lukegb/ntfy

ntfy: fix on Darwin
This commit is contained in:
Luke Granger-Brown 2022-10-02 23:59:35 +01:00 committed by GitHub
commit e0b437e584
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 15 deletions

View file

@ -74,7 +74,6 @@ buildPythonPackage rec {
]; ];
meta = with lib; { meta = with lib; {
broken = stdenv.isDarwin;
description = "Slack Developer Kit for Python"; description = "Slack Developer Kit for Python";
homepage = "https://slack.dev/python-slack-sdk/"; homepage = "https://slack.dev/python-slack-sdk/";
license = with licenses; [ mit ]; license = with licenses; [ mit ];

View file

@ -1,15 +1,18 @@
{ lib { lib
, python39 , stdenv
, python
, fetchFromGitHub , fetchFromGitHub
, fetchpatch , fetchpatch
, withXmpp ? !stdenv.isDarwin
, withMatrix ? true
, withSlack ? true
, withEmoji ? true
, withPid ? true
, withDbus ? stdenv.isLinux
}: }:
let let
python = python39.override { ntfy-webpush = python.pkgs.callPackage ./webpush.nix { };
packageOverrides = self: super: {
ntfy-webpush = self.callPackage ./webpush.nix { };
};
};
in python.pkgs.buildPythonApplication rec { in python.pkgs.buildPythonApplication rec {
pname = "ntfy"; pname = "ntfy";
version = "2.7.0"; version = "2.7.0";
@ -27,16 +30,22 @@ in python.pkgs.buildPythonApplication rec {
mock mock
]; ];
propagatedBuildInputs = with python.pkgs; [ propagatedBuildInputs = with python.pkgs; ([
requests ruamel-yaml appdirs requests ruamel-yaml appdirs
sleekxmpp dnspython
emoji
psutil
matrix-client
dbus-python
ntfy-webpush ntfy-webpush
] ++ (lib.optionals withXmpp [
sleekxmpp dnspython
]) ++ (lib.optionals withMatrix [
matrix-client
]) ++ (lib.optionals withSlack [
slack-sdk slack-sdk
]; ]) ++ (lib.optionals withEmoji [
emoji
]) ++ (lib.optionals withPid [
psutil
]) ++ (lib.optionals withDbus [
dbus-python
]));
patches = [ patches = [
# Fix Slack integration no longer working. # Fix Slack integration no longer working.
@ -55,6 +64,12 @@ in python.pkgs.buildPythonApplication rec {
}) })
]; ];
postPatch = ''
# We disable the Darwin specific things because it relies on pyobjc, which we don't have.
substituteInPlace setup.py \
--replace "':sys_platform == \"darwin\"'" "'darwin'"
'';
checkPhase = '' checkPhase = ''
HOME=$(mktemp -d) ${python.interpreter} setup.py test HOME=$(mktemp -d) ${python.interpreter} setup.py test
''; '';

View file

@ -9516,7 +9516,7 @@ with pkgs;
# ntfsprogs are merged into ntfs-3g # ntfsprogs are merged into ntfs-3g
ntfsprogs = pkgs.ntfs3g; ntfsprogs = pkgs.ntfs3g;
ntfy = callPackage ../tools/misc/ntfy {}; ntfy = callPackage ../tools/misc/ntfy { python = python39; };
ntfy-sh = callPackage ../tools/misc/ntfy-sh { }; ntfy-sh = callPackage ../tools/misc/ntfy-sh { };