Merge pull request #162418 from dotlambda/nextcord-init

python3Packages.nextcord: init at 2.0.0a8
This commit is contained in:
Ivv 2022-03-02 16:45:40 +01:00 committed by GitHub
commit d5bdc09f3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 92 additions and 0 deletions

View file

@ -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 ];
};
}

View file

@ -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")

View file

@ -5472,6 +5472,8 @@ in {
nextcloudmonitor = callPackage ../development/python-modules/nextcloudmonitor { };
nextcord = callPackage ../development/python-modules/nextcord { };
nghttp2 = (toPythonModule (pkgs.nghttp2.override {
inherit (self) python cython setuptools;
inherit (pkgs) ncurses;