1{ stdenv
2, lib
3, buildPythonPackage
4, fetchFromGitHub
5, glibcLocales
6, nose
7, pylibmc
8, memcached
9, redis
10, pymongo
11, mock
12, webtest
13, sqlalchemy
14, pycrypto
15, cryptography
16, isPy27
17, isPy3k
18, funcsigs ? null
19, pycryptopp ? null
20}:
21
22buildPythonPackage rec {
23 pname = "Beaker";
24 version = "1.11.0";
25
26 # The pypy release do not contains the tests
27 src = fetchFromGitHub {
28 owner = "bbangert";
29 repo = "beaker";
30 rev = version;
31 sha256 = "059sc7iar90lc2y9mppdis5ddfcxyirz03gmsfb0307f5dsa1dhj";
32 };
33
34 propagatedBuildInputs = [
35 sqlalchemy
36 pycrypto
37 cryptography
38 ] ++ lib.optionals (isPy27) [
39 funcsigs
40 pycryptopp
41 ];
42
43 checkInputs = [
44 glibcLocales
45 memcached
46 mock
47 nose
48 pylibmc
49 pymongo
50 redis
51 webtest
52 ];
53
54 # Can not run memcached tests because it immediately tries to connect
55 postPatch = lib.optionalString isPy3k ''
56 substituteInPlace setup.py \
57 --replace "python-memcached" "python3-memcached"
58 '' + ''
59
60 rm tests/test_memcached.py
61 '';
62
63 # Disable external tests because they need to connect to a live database.
64 # Also disable a test in test_cache.py called "test_upgrade" because
65 # it currently fails on darwin.
66 # Please see issue https://github.com/bbangert/beaker/issues/166
67 checkPhase = ''
68 nosetests \
69 -e ".*test_ext_.*" \
70 -e "test_upgrade" \
71 ${lib.optionalString (!stdenv.isLinux) ''-e "test_cookie_expires_different_locale"''} \
72 -vv tests
73 '';
74
75 meta = {
76 description = "A Session and Caching library with WSGI Middleware";
77 maintainers = with lib.maintainers; [ domenkozar ];
78 };
79}