summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/yowsup/default.nix
blob: 39a6579dd7c5b237bd965a9936ec204fd34d4320 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{
  lib,
  buildPythonPackage,
  pythonOlder,
  isPy3k,
  fetchFromGitHub,
  setuptools,
  appdirs,
  consonance,
  protobuf,
  python-axolotl,
  six,
  pyasyncore,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "yowsup";
  version = "3.3.0";
  pyproject = true;

  # The Python 2.x support of this package is incompatible with `six==1.11`:
  # https://github.com/tgalal/yowsup/issues/2416#issuecomment-365113486
  disabled = !isPy3k;

  src = fetchFromGitHub {
    owner = "tgalal";
    repo = "yowsup";
    tag = "v${version}";
    sha256 = "1pz0r1gif15lhzdsam8gg3jm6zsskiv2yiwlhaif5rl7lv3p0v7q";
  };

  pythonRelaxDeps = true;
  pythonRemoveDeps = [ "argparse" ];

  env = {
    # make protobuf compatible with old versions
    # https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
    PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION = "python";
  };

  build-system = [ setuptools ];

  nativeCheckInputs = [ pytestCheckHook ];

  dependencies = [
    appdirs
    consonance
    protobuf
    python-axolotl
    six
  ]
  ++ lib.optionals (!pythonOlder "3.12") [ pyasyncore ];

  meta = {
    homepage = "https://github.com/tgalal/yowsup";
    description = "Python WhatsApp library";
    mainProgram = "yowsup-cli";
    license = lib.licenses.gpl3Plus;
    maintainers = [ ];
  };
}