2016-12-14 19:13:52 +01:00
|
|
|
{ lib
|
2020-01-10 20:34:18 +01:00
|
|
|
, fetchFromGitHub
|
2016-12-14 19:13:52 +01:00
|
|
|
, buildPythonPackage
|
|
|
|
, pythonOlder
|
|
|
|
, withVoice ? true, libopus
|
|
|
|
, aiohttp
|
|
|
|
, websockets
|
|
|
|
, pynacl
|
|
|
|
}:
|
|
|
|
|
2018-01-29 18:45:38 +01:00
|
|
|
buildPythonPackage rec {
|
2016-12-14 19:13:52 +01:00
|
|
|
pname = "discord.py";
|
2020-01-10 20:34:18 +01:00
|
|
|
version = "1.2.5";
|
|
|
|
disabled = pythonOlder "3.5.3";
|
2016-12-14 19:13:52 +01:00
|
|
|
|
2020-01-10 20:34:18 +01:00
|
|
|
# only distributes wheels on pypi now
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Rapptz";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "17l6mlfi9ikqndpmi4pwlvb53g132cycyfm9nzdyiqr96k8ly4ig";
|
2016-12-14 19:13:52 +01:00
|
|
|
};
|
|
|
|
|
2020-01-10 20:34:18 +01:00
|
|
|
propagatedBuildInputs = [ aiohttp websockets ];
|
2016-12-14 19:13:52 +01:00
|
|
|
patchPhase = ''
|
|
|
|
substituteInPlace "requirements.txt" \
|
2020-01-10 20:34:18 +01:00
|
|
|
--replace "aiohttp>=3.3.0,<3.6.0" "aiohttp~=3.3" \
|
|
|
|
--replace "websockets>=6.0,<7.0" "websockets>=6"
|
2016-12-14 19:13:52 +01:00
|
|
|
'' + lib.optionalString withVoice ''
|
|
|
|
substituteInPlace "discord/opus.py" \
|
|
|
|
--replace "ctypes.util.find_library('opus')" "'${libopus}/lib/libopus.so.0'"
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
2020-01-10 20:34:18 +01:00
|
|
|
# only have integration tests with discord
|
2017-09-05 11:16:41 +02:00
|
|
|
doCheck = false;
|
|
|
|
|
2020-01-10 20:34:18 +01:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"discord"
|
|
|
|
"discord.file"
|
|
|
|
"discord.member"
|
|
|
|
"discord.user"
|
|
|
|
"discord.state"
|
|
|
|
"discord.guild"
|
|
|
|
"discord.webhook"
|
|
|
|
"discord.ext.commands.bot"
|
|
|
|
];
|
|
|
|
|
2016-12-14 19:13:52 +01:00
|
|
|
meta = {
|
|
|
|
description = "A python wrapper for the Discord API";
|
|
|
|
homepage = "https://discordpy.rtfd.org/";
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
};
|
|
|
|
}
|