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