Show More
@@ -0,0 +1,18 b'' | |||
|
1 | diff -rup Beaker-1.9.1-orig/beaker/session.py Beaker-1.9.1/beaker/session.py | |
|
2 | --- Beaker-1.9.1-orig/beaker/session.py 2020-04-10 10:23:04.000000000 +0200 | |
|
3 | +++ Beaker-1.9.1/beaker/session.py 2020-04-10 10:23:34.000000000 +0200 | |
|
4 | @@ -156,6 +156,14 @@ def __init__(self, request, id=None, invalidate_corrupt=False, | |
|
5 | if timeout and not save_accessed_time: | |
|
6 | raise BeakerException("timeout requires save_accessed_time") | |
|
7 | self.timeout = timeout | |
|
8 | + # We want to pass timeout param to redis backend to support expiration of keys | |
|
9 | + # In future, I believe, we can use this param for memcached and mongo as well | |
|
10 | + if self.timeout is not None and self.type == 'ext:redis': | |
|
11 | + # The backend expiration should always be a bit longer (I decied to use 2 minutes) than the | |
|
12 | + # session expiration itself to prevent the case where the backend data expires while | |
|
13 | + # the session is being read (PR#153) | |
|
14 | + self.namespace_args['timeout'] = self.timeout + 60 * 2 | |
|
15 | + | |
|
16 | self.save_atime = save_accessed_time | |
|
17 | self.use_cookies = use_cookies | |
|
18 | self.cookie_expires = cookie_expires No newline at end of file |
@@ -0,0 +1,26 b'' | |||
|
1 | diff -rup Beaker-1.9.1-orig/beaker/ext/redisnm.py Beaker-1.9.1/beaker/ext/redisnm.py | |
|
2 | --- Beaker-1.9.1-orig/beaker/ext/redisnm.py 2018-04-10 10:23:04.000000000 +0200 | |
|
3 | +++ Beaker-1.9.1/beaker/ext/redisnm.py 2018-04-10 10:23:34.000000000 +0200 | |
|
4 | @@ -30,9 +30,10 @@ class RedisNamespaceManager(NamespaceManager): | |
|
5 | ||
|
6 | clients = SyncDict() | |
|
7 | ||
|
8 | - def __init__(self, namespace, url, **kw): | |
|
9 | + def __init__(self, namespace, url, timeout=None, **kw): | |
|
10 | super(RedisNamespaceManager, self).__init__(namespace) | |
|
11 | self.lock_dir = None # Redis uses redis itself for locking. | |
|
12 | + self.timeout = timeout | |
|
13 | ||
|
14 | if redis is None: | |
|
15 | raise RuntimeError('redis is not available') | |
|
16 | @@ -68,6 +69,8 @@ def has_key(self, key): | |
|
17 | ||
|
18 | def set_value(self, key, value, expiretime=None): | |
|
19 | value = pickle.dumps(value) | |
|
20 | + if expiretime is None and self.timeout is not None: | |
|
21 | + expiretime = self.timeout | |
|
22 | if expiretime is not None: | |
|
23 | self.client.setex(self._format_key(key), int(expiretime), value) | |
|
24 | else: | |
|
25 | ||
|
26 |
@@ -1,279 +1,281 b'' | |||
|
1 | 1 | # Overrides for the generated python-packages.nix |
|
2 | 2 | # |
|
3 | 3 | # This function is intended to be used as an extension to the generated file |
|
4 | 4 | # python-packages.nix. The main objective is to add needed dependencies of C |
|
5 | 5 | # libraries and tweak the build instructions where needed. |
|
6 | 6 | |
|
7 | 7 | { pkgs |
|
8 | 8 | , basePythonPackages |
|
9 | 9 | }: |
|
10 | 10 | |
|
11 | 11 | let |
|
12 | 12 | sed = "sed -i"; |
|
13 | 13 | |
|
14 | 14 | localLicenses = { |
|
15 | 15 | repoze = { |
|
16 | 16 | fullName = "Repoze License"; |
|
17 | 17 | url = http://www.repoze.org/LICENSE.txt; |
|
18 | 18 | }; |
|
19 | 19 | }; |
|
20 | 20 | |
|
21 | 21 | in |
|
22 | 22 | |
|
23 | 23 | self: super: { |
|
24 | 24 | |
|
25 | 25 | "appenlight-client" = super."appenlight-client".override (attrs: { |
|
26 | 26 | meta = { |
|
27 | 27 | license = [ pkgs.lib.licenses.bsdOriginal ]; |
|
28 | 28 | }; |
|
29 | 29 | }); |
|
30 | 30 | |
|
31 | 31 | "beaker" = super."beaker".override (attrs: { |
|
32 | 32 | patches = [ |
|
33 | 33 | ./patches/beaker/patch-beaker-lock-func-debug.diff |
|
34 | 34 | ./patches/beaker/patch-beaker-metadata-reuse.diff |
|
35 | ./patches/beaker/patch-beaker-improved-redis.diff | |
|
36 | ./patches/beaker/patch-beaker-improved-redis-2.diff | |
|
35 | 37 | ]; |
|
36 | 38 | }); |
|
37 | 39 | |
|
38 | 40 | "cffi" = super."cffi".override (attrs: { |
|
39 | 41 | buildInputs = [ |
|
40 | 42 | pkgs.libffi |
|
41 | 43 | ]; |
|
42 | 44 | }); |
|
43 | 45 | |
|
44 | 46 | "cryptography" = super."cryptography".override (attrs: { |
|
45 | 47 | buildInputs = [ |
|
46 | 48 | pkgs.openssl |
|
47 | 49 | ]; |
|
48 | 50 | }); |
|
49 | 51 | |
|
50 | 52 | "gevent" = super."gevent".override (attrs: { |
|
51 | 53 | propagatedBuildInputs = attrs.propagatedBuildInputs ++ [ |
|
52 | 54 | # NOTE: (marcink) odd requirements from gevent aren't set properly, |
|
53 | 55 | # thus we need to inject psutil manually |
|
54 | 56 | self."psutil" |
|
55 | 57 | ]; |
|
56 | 58 | }); |
|
57 | 59 | |
|
58 | 60 | "future" = super."future".override (attrs: { |
|
59 | 61 | meta = { |
|
60 | 62 | license = [ pkgs.lib.licenses.mit ]; |
|
61 | 63 | }; |
|
62 | 64 | }); |
|
63 | 65 | |
|
64 | 66 | "testpath" = super."testpath".override (attrs: { |
|
65 | 67 | meta = { |
|
66 | 68 | license = [ pkgs.lib.licenses.mit ]; |
|
67 | 69 | }; |
|
68 | 70 | }); |
|
69 | 71 | |
|
70 | 72 | "gnureadline" = super."gnureadline".override (attrs: { |
|
71 | 73 | buildInputs = [ |
|
72 | 74 | pkgs.ncurses |
|
73 | 75 | ]; |
|
74 | 76 | patchPhase = '' |
|
75 | 77 | substituteInPlace setup.py --replace "/bin/bash" "${pkgs.bash}/bin/bash" |
|
76 | 78 | ''; |
|
77 | 79 | }); |
|
78 | 80 | |
|
79 | 81 | "gunicorn" = super."gunicorn".override (attrs: { |
|
80 | 82 | propagatedBuildInputs = [ |
|
81 | 83 | # johbo: futures is needed as long as we are on Python 2, otherwise |
|
82 | 84 | # gunicorn explodes if used with multiple threads per worker. |
|
83 | 85 | self."futures" |
|
84 | 86 | ]; |
|
85 | 87 | }); |
|
86 | 88 | |
|
87 | 89 | "nbconvert" = super."nbconvert".override (attrs: { |
|
88 | 90 | propagatedBuildInputs = attrs.propagatedBuildInputs ++ [ |
|
89 | 91 | # marcink: plug in jupyter-client for notebook rendering |
|
90 | 92 | self."jupyter-client" |
|
91 | 93 | ]; |
|
92 | 94 | }); |
|
93 | 95 | |
|
94 | 96 | "ipython" = super."ipython".override (attrs: { |
|
95 | 97 | propagatedBuildInputs = attrs.propagatedBuildInputs ++ [ |
|
96 | 98 | self."gnureadline" |
|
97 | 99 | ]; |
|
98 | 100 | }); |
|
99 | 101 | |
|
100 | 102 | "lxml" = super."lxml".override (attrs: { |
|
101 | 103 | buildInputs = [ |
|
102 | 104 | pkgs.libxml2 |
|
103 | 105 | pkgs.libxslt |
|
104 | 106 | ]; |
|
105 | 107 | propagatedBuildInputs = [ |
|
106 | 108 | # Needed, so that "setup.py bdist_wheel" does work |
|
107 | 109 | self."wheel" |
|
108 | 110 | ]; |
|
109 | 111 | }); |
|
110 | 112 | |
|
111 | 113 | "mysql-python" = super."mysql-python".override (attrs: { |
|
112 | 114 | buildInputs = [ |
|
113 | 115 | pkgs.openssl |
|
114 | 116 | ]; |
|
115 | 117 | propagatedBuildInputs = [ |
|
116 | 118 | pkgs.libmysql |
|
117 | 119 | pkgs.zlib |
|
118 | 120 | ]; |
|
119 | 121 | }); |
|
120 | 122 | |
|
121 | 123 | "psycopg2" = super."psycopg2".override (attrs: { |
|
122 | 124 | propagatedBuildInputs = [ |
|
123 | 125 | pkgs.postgresql |
|
124 | 126 | ]; |
|
125 | 127 | meta = { |
|
126 | 128 | license = pkgs.lib.licenses.lgpl3Plus; |
|
127 | 129 | }; |
|
128 | 130 | }); |
|
129 | 131 | |
|
130 | 132 | "pycurl" = super."pycurl".override (attrs: { |
|
131 | 133 | propagatedBuildInputs = [ |
|
132 | 134 | pkgs.curl |
|
133 | 135 | pkgs.openssl |
|
134 | 136 | ]; |
|
135 | 137 | |
|
136 | 138 | preConfigure = '' |
|
137 | 139 | substituteInPlace setup.py --replace '--static-libs' '--libs' |
|
138 | 140 | export PYCURL_SSL_LIBRARY=openssl |
|
139 | 141 | ''; |
|
140 | 142 | |
|
141 | 143 | meta = { |
|
142 | 144 | license = pkgs.lib.licenses.mit; |
|
143 | 145 | }; |
|
144 | 146 | }); |
|
145 | 147 | |
|
146 | 148 | "pyramid" = super."pyramid".override (attrs: { |
|
147 | 149 | meta = { |
|
148 | 150 | license = localLicenses.repoze; |
|
149 | 151 | }; |
|
150 | 152 | }); |
|
151 | 153 | |
|
152 | 154 | "pyramid-debugtoolbar" = super."pyramid-debugtoolbar".override (attrs: { |
|
153 | 155 | meta = { |
|
154 | 156 | license = [ pkgs.lib.licenses.bsdOriginal localLicenses.repoze ]; |
|
155 | 157 | }; |
|
156 | 158 | }); |
|
157 | 159 | |
|
158 | 160 | "pysqlite" = super."pysqlite".override (attrs: { |
|
159 | 161 | propagatedBuildInputs = [ |
|
160 | 162 | pkgs.sqlite |
|
161 | 163 | ]; |
|
162 | 164 | meta = { |
|
163 | 165 | license = [ pkgs.lib.licenses.zlib pkgs.lib.licenses.libpng ]; |
|
164 | 166 | }; |
|
165 | 167 | }); |
|
166 | 168 | |
|
167 | 169 | "python-ldap" = super."python-ldap".override (attrs: { |
|
168 | 170 | propagatedBuildInputs = attrs.propagatedBuildInputs ++ [ |
|
169 | 171 | pkgs.openldap |
|
170 | 172 | pkgs.cyrus_sasl |
|
171 | 173 | pkgs.openssl |
|
172 | 174 | ]; |
|
173 | 175 | }); |
|
174 | 176 | |
|
175 | 177 | "python-pam" = super."python-pam".override (attrs: { |
|
176 | 178 | propagatedBuildInputs = [ |
|
177 | 179 | pkgs.pam |
|
178 | 180 | ]; |
|
179 | 181 | |
|
180 | 182 | # TODO: johbo: Check if this can be avoided, or transform into |
|
181 | 183 | # a real patch |
|
182 | 184 | patchPhase = '' |
|
183 | 185 | substituteInPlace pam.py \ |
|
184 | 186 | --replace 'find_library("pam")' '"${pkgs.pam}/lib/libpam.so.0"' |
|
185 | 187 | ''; |
|
186 | 188 | |
|
187 | 189 | }); |
|
188 | 190 | |
|
189 | 191 | "python-saml" = super."python-saml".override (attrs: { |
|
190 | 192 | buildInputs = [ |
|
191 | 193 | pkgs.libxml2 |
|
192 | 194 | pkgs.libxslt |
|
193 | 195 | ]; |
|
194 | 196 | }); |
|
195 | 197 | |
|
196 | 198 | "dm.xmlsec.binding" = super."dm.xmlsec.binding".override (attrs: { |
|
197 | 199 | buildInputs = [ |
|
198 | 200 | pkgs.libxml2 |
|
199 | 201 | pkgs.libxslt |
|
200 | 202 | pkgs.xmlsec |
|
201 | 203 | pkgs.libtool |
|
202 | 204 | ]; |
|
203 | 205 | }); |
|
204 | 206 | |
|
205 | 207 | "pyzmq" = super."pyzmq".override (attrs: { |
|
206 | 208 | buildInputs = [ |
|
207 | 209 | pkgs.czmq |
|
208 | 210 | ]; |
|
209 | 211 | }); |
|
210 | 212 | |
|
211 | 213 | "urlobject" = super."urlobject".override (attrs: { |
|
212 | 214 | meta = { |
|
213 | 215 | license = { |
|
214 | 216 | spdxId = "Unlicense"; |
|
215 | 217 | fullName = "The Unlicense"; |
|
216 | 218 | url = http://unlicense.org/; |
|
217 | 219 | }; |
|
218 | 220 | }; |
|
219 | 221 | }); |
|
220 | 222 | |
|
221 | 223 | "docutils" = super."docutils".override (attrs: { |
|
222 | 224 | meta = { |
|
223 | 225 | license = pkgs.lib.licenses.bsd2; |
|
224 | 226 | }; |
|
225 | 227 | }); |
|
226 | 228 | |
|
227 | 229 | "colander" = super."colander".override (attrs: { |
|
228 | 230 | meta = { |
|
229 | 231 | license = localLicenses.repoze; |
|
230 | 232 | }; |
|
231 | 233 | }); |
|
232 | 234 | |
|
233 | 235 | "pyramid-beaker" = super."pyramid-beaker".override (attrs: { |
|
234 | 236 | meta = { |
|
235 | 237 | license = localLicenses.repoze; |
|
236 | 238 | }; |
|
237 | 239 | }); |
|
238 | 240 | |
|
239 | 241 | "pyramid-mako" = super."pyramid-mako".override (attrs: { |
|
240 | 242 | meta = { |
|
241 | 243 | license = localLicenses.repoze; |
|
242 | 244 | }; |
|
243 | 245 | }); |
|
244 | 246 | |
|
245 | 247 | "repoze.lru" = super."repoze.lru".override (attrs: { |
|
246 | 248 | meta = { |
|
247 | 249 | license = localLicenses.repoze; |
|
248 | 250 | }; |
|
249 | 251 | }); |
|
250 | 252 | |
|
251 | 253 | "python-editor" = super."python-editor".override (attrs: { |
|
252 | 254 | meta = { |
|
253 | 255 | license = pkgs.lib.licenses.asl20; |
|
254 | 256 | }; |
|
255 | 257 | }); |
|
256 | 258 | |
|
257 | 259 | "translationstring" = super."translationstring".override (attrs: { |
|
258 | 260 | meta = { |
|
259 | 261 | license = localLicenses.repoze; |
|
260 | 262 | }; |
|
261 | 263 | }); |
|
262 | 264 | |
|
263 | 265 | "venusian" = super."venusian".override (attrs: { |
|
264 | 266 | meta = { |
|
265 | 267 | license = localLicenses.repoze; |
|
266 | 268 | }; |
|
267 | 269 | }); |
|
268 | 270 | |
|
269 | 271 | "supervisor" = super."supervisor".override (attrs: { |
|
270 | 272 | patches = [ |
|
271 | 273 | ./patches/supervisor/patch-rlimits-old-kernel.diff |
|
272 | 274 | ]; |
|
273 | 275 | }); |
|
274 | 276 | |
|
275 | 277 | # Avoid that base packages screw up the build process |
|
276 | 278 | inherit (basePythonPackages) |
|
277 | 279 | setuptools; |
|
278 | 280 | |
|
279 | 281 | } |
General Comments 0
You need to be logged in to leave comments.
Login now