summary refs log tree commit diff
path: root/pkgs/development/python-modules
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules')
-rw-r--r--pkgs/development/python-modules/fleep/0001-Fixing-paths-on-tests.patch48
-rw-r--r--pkgs/development/python-modules/fleep/default.nix36
-rw-r--r--pkgs/development/python-modules/graphql-subscription-manager/default.nix4
-rw-r--r--pkgs/development/python-modules/nextcord/default.nix64
-rw-r--r--pkgs/development/python-modules/nextcord/paths.patch26
5 files changed, 176 insertions, 2 deletions
diff --git a/pkgs/development/python-modules/fleep/0001-Fixing-paths-on-tests.patch b/pkgs/development/python-modules/fleep/0001-Fixing-paths-on-tests.patch
new file mode 100644
index 0000000000000..234bf0cb379b5
--- /dev/null
+++ b/pkgs/development/python-modules/fleep/0001-Fixing-paths-on-tests.patch
@@ -0,0 +1,48 @@
+From 716fcfa3203bc881b543916bdb9a17460951cd26 Mon Sep 17 00:00:00 2001
+From: "P. R. d. O" <d.ol.rod@protonmail.com>
+Date: Fri, 26 Nov 2021 07:13:32 -0600
+Subject: [PATCH] Fixing paths on tests
+
+---
+ tests/maintest.py  | 7 ++++++-
+ tests/speedtest.py | 7 ++++++-
+ 2 files changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/tests/maintest.py b/tests/maintest.py
+index 0e24ca4..3484437 100644
+--- a/tests/maintest.py
++++ b/tests/maintest.py
+@@ -1,6 +1,11 @@
+ import fleep
++import os
+ 
+-with open("testfile", "rb") as file:
++current_dir = os.path.realpath(os.path.join(os.getcwd(),
++                                            os.path.dirname(__file__)))
++
++with open(os.path.join(current_dir, "./testfile"),
++          "rb") as file:
+     info = fleep.get(file.read(128))
+ 
+ assert info.type == ["raster-image"]
+diff --git a/tests/speedtest.py b/tests/speedtest.py
+index 89338ab..829d563 100644
+--- a/tests/speedtest.py
++++ b/tests/speedtest.py
+@@ -1,7 +1,12 @@
+ import time
+ import fleep
++import os
+ 
+-with open("testfile", "rb") as file:
++current_dir = os.path.realpath(os.path.join(os.getcwd(),
++                                            os.path.dirname(__file__)))
++
++with open(os.path.join(current_dir, "./testfile"),
++          "rb") as file:
+     stream = file.read(128)
+ 
+ times = []
+-- 
+2.33.1
+
diff --git a/pkgs/development/python-modules/fleep/default.nix b/pkgs/development/python-modules/fleep/default.nix
new file mode 100644
index 0000000000000..04b607325136e
--- /dev/null
+++ b/pkgs/development/python-modules/fleep/default.nix
@@ -0,0 +1,36 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, python
+}:
+
+buildPythonPackage rec {
+  pname = "fleep";
+  version = "1.0.1";
+
+  # Pypi version does not have tests
+  src = fetchFromGitHub {
+    owner = "floyernick";
+    repo = "fleep-py";
+    rev = "994bc2c274482d80ab13d89d8f7343eb316d3e44";
+    sha256 = "sha256-TaU7njx98nxkhZawGMFqWj4g+yCtIX9aPWQHoamzfMY=";
+  };
+
+  patches = [
+    ./0001-Fixing-paths-on-tests.patch
+  ];
+
+  checkPhase = ''
+    ${python.interpreter} tests/maintest.py
+    ${python.interpreter} tests/speedtest.py
+  '';
+
+  pythonImportsCheck = [ "fleep" ];
+
+  meta = with lib; {
+    description = "File format determination library";
+    homepage = "https://github.com/floyernick/fleep-py";
+    license = licenses.mit;
+    maintainers = with maintainers; [ wolfangaukang ];
+  };
+}
diff --git a/pkgs/development/python-modules/graphql-subscription-manager/default.nix b/pkgs/development/python-modules/graphql-subscription-manager/default.nix
index db3aea752b709..afcbe157a1e24 100644
--- a/pkgs/development/python-modules/graphql-subscription-manager/default.nix
+++ b/pkgs/development/python-modules/graphql-subscription-manager/default.nix
@@ -8,7 +8,7 @@
 
 buildPythonPackage rec {
   pname = "graphql-subscription-manager";
-  version = "0.5.0";
+  version = "0.5.1";
 
   disabled = pythonOlder "3.7";
 
@@ -16,7 +16,7 @@ buildPythonPackage rec {
     owner = "Danielhiversen";
     repo = "PyGraphqlWebsocketManager";
     rev = version;
-    sha256 = "sha256-18GR0OZeEh6EQT0kKCJyq7ckvKYKDJn/lugN5xlRg64=";
+    sha256 = "sha256-PVQa6JmBnToXuL/wNkYO0b+K1e9yrQgRUzWNUbFN5mM=";
   };
 
   propagatedBuildInputs = [
diff --git a/pkgs/development/python-modules/nextcord/default.nix b/pkgs/development/python-modules/nextcord/default.nix
new file mode 100644
index 0000000000000..345a77239bf4b
--- /dev/null
+++ b/pkgs/development/python-modules/nextcord/default.nix
@@ -0,0 +1,64 @@
+{ lib
+, stdenv
+, buildPythonPackage
+, pythonOlder
+, fetchFromGitHub
+, substituteAll
+, ffmpeg
+, libopus
+, aiohttp
+, aiodns
+, brotli
+, cchardet
+, orjson
+, pynacl
+}:
+
+buildPythonPackage rec {
+  pname = "nextcord";
+  version = "2.0.0a8";
+
+  format = "setuptools";
+
+  disabled = pythonOlder "3.8";
+
+  src = fetchFromGitHub {
+    owner = "nextcord";
+    repo = "nextcord";
+    rev = version;
+    hash = "sha256-aYFY58zWZlZwW3xwa1iAK4w29AofKIkTyCjQ2nR8JrY=";
+  };
+
+  patches = [
+    (substituteAll {
+      src = ./paths.patch;
+      ffmpeg = "${ffmpeg}/bin/ffmpeg";
+      libopus = "${libopus}/lib/libopus${stdenv.hostPlatform.extensions.sharedLibrary}";
+    })
+  ];
+
+  propagatedBuildInputs = [
+    aiodns
+    aiohttp
+    brotli
+    cchardet
+    orjson
+    pynacl
+  ];
+
+  # upstream has no tests
+  doCheck = false;
+
+  pythonImportsCheck = [
+    "nextcord"
+    "nextcord.ext.commands"
+    "nextcord.ext.tasks"
+  ];
+
+  meta = with lib; {
+    description = "Python wrapper for the Discord API forked from discord.py";
+    homepage = "https://github.com/nextcord/nextcord";
+    license = licenses.mit;
+    maintainers = with maintainers; [ dotlambda ];
+  };
+}
diff --git a/pkgs/development/python-modules/nextcord/paths.patch b/pkgs/development/python-modules/nextcord/paths.patch
new file mode 100644
index 0000000000000..389637a18878c
--- /dev/null
+++ b/pkgs/development/python-modules/nextcord/paths.patch
@@ -0,0 +1,26 @@
+diff --git a/nextcord/opus.py b/nextcord/opus.py
+index 97d437a3..755e1a5c 100644
+--- a/nextcord/opus.py
++++ b/nextcord/opus.py
+@@ -213,7 +213,7 @@ def _load_default() -> bool:
+             _filename = os.path.join(_basedir, 'bin', f'libopus-0.{_target}.dll')
+             _lib = libopus_loader(_filename)
+         else:
+-            _lib = libopus_loader(ctypes.util.find_library('opus'))
++            _lib = libopus_loader('@libopus@')
+     except Exception:
+         _lib = None
+ 
+diff --git a/nextcord/player.py b/nextcord/player.py
+index bedefc5a..34de0459 100644
+--- a/nextcord/player.py
++++ b/nextcord/player.py
+@@ -140,7 +140,7 @@ class FFmpegAudio(AudioSource):
+     .. versionadded:: 1.3
+     """
+ 
+-    def __init__(self, source: Union[str, io.BufferedIOBase], *, executable: str = 'ffmpeg', args: Any, **subprocess_kwargs: Any):
++    def __init__(self, source: Union[str, io.BufferedIOBase], *, executable: str = '@ffmpeg@', args: Any, **subprocess_kwargs: Any):
+         piping = subprocess_kwargs.get('stdin') == subprocess.PIPE
+         if piping and isinstance(source, str):
+             raise TypeError("parameter conflict: 'source' parameter cannot be a string when piping to stdin")