about summary refs log tree commit diff
path: root/pkgs/development/python-modules/beaker/default.nix
blob: a369c25e8970d91d8565d740a528e3a0a06df495 (plain) (blame)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{
  stdenv,
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  glibcLocales,
  nose,
  pylibmc,
  python-memcached,
  redis,
  pymongo,
  mock,
  webtest,
  sqlalchemy,
  pycrypto,
  cryptography,
  isPy27,
  isPy3k,
  funcsigs ? null,
  pycryptopp ? null,
}:

buildPythonPackage rec {
  pname = "beaker";
  version = "1.13.0";

  # The pypy release do not contains the tests
  src = fetchFromGitHub {
    owner = "bbangert";
    repo = "beaker";
    rev = "refs/tags/${version}";
    sha256 = "sha256-HzjhOPXElwKoJLrhGIbVn798tbX/kaS1EpQIX+vXCtE=";
  };

  propagatedBuildInputs =
    [
      sqlalchemy
      pycrypto
      cryptography
    ]
    ++ lib.optionals (isPy27) [
      funcsigs
      pycryptopp
    ];

  nativeCheckInputs = [
    glibcLocales
    python-memcached
    mock
    nose
    pylibmc
    pymongo
    redis
    webtest
  ];

  # Can not run memcached tests because it immediately tries to connect
  postPatch = ''
    rm tests/test_memcached.py
  '';

  # Disable external tests because they need to connect to a live database.
  # Also disable a test in test_cache.py called "test_upgrade" because
  # it currently fails on darwin.
  # Please see issue https://github.com/bbangert/beaker/issues/166
  checkPhase = ''
    nosetests \
      -e ".*test_ext_.*" \
      -e "test_upgrade" \
      ${lib.optionalString (!stdenv.isLinux) ''-e "test_cookie_expires_different_locale"''} \
      -vv tests
  '';

  meta = {
    description = "Session and Caching library with WSGI Middleware";
    homepage = "https://github.com/bbangert/beaker";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ domenkozar ];
    knownVulnerabilities = [ "CVE-2013-7489" ];
  };
}