1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 isPy3k,
6 fetchFromGitHub,
7 appdirs,
8 consonance,
9 protobuf,
10 python-axolotl,
11 six,
12 pyasyncore,
13 pytestCheckHook,
14}:
15
16buildPythonPackage rec {
17 pname = "yowsup";
18 version = "3.3.0";
19 format = "setuptools";
20
21 # The Python 2.x support of this package is incompatible with `six==1.11`:
22 # https://github.com/tgalal/yowsup/issues/2416#issuecomment-365113486
23 disabled = !isPy3k;
24
25 src = fetchFromGitHub {
26 owner = "tgalal";
27 repo = "yowsup";
28 rev = "v${version}";
29 sha256 = "1pz0r1gif15lhzdsam8gg3jm6zsskiv2yiwlhaif5rl7lv3p0v7q";
30 };
31
32 postPatch = ''
33 substituteInPlace setup.py \
34 --replace "argparse" "" \
35 --replace "==" ">=" \
36 '';
37
38 nativeCheckInputs = [ pytestCheckHook ];
39
40 propagatedBuildInputs = [
41 appdirs
42 consonance
43 protobuf
44 python-axolotl
45 six
46 ] ++ lib.optionals (!pythonOlder "3.12") [ pyasyncore ];
47
48 meta = with lib; {
49 homepage = "https://github.com/tgalal/yowsup";
50 description = "Python WhatsApp library";
51 mainProgram = "yowsup-cli";
52 license = licenses.gpl3Plus;
53 maintainers = [ ];
54 };
55}