Gentoo Archives: gentoo-commits

From: Marius Brehler <marbre@××××××××××××××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: dev-python/notebook/files/, dev-python/notebook/
Date: Sat, 28 Nov 2015 17:58:20
Message-Id: 1448733136.374b2ddcb384c9a37adfe96c26278e5f59256542.marbre@gentoo
1 commit: 374b2ddcb384c9a37adfe96c26278e5f59256542
2 Author: Marius Brehler <marbre <AT> linux <DOT> sungazer <DOT> de>
3 AuthorDate: Sat Nov 28 17:52:16 2015 +0000
4 Commit: Marius Brehler <marbre <AT> linux <DOT> sungazer <DOT> de>
5 CommitDate: Sat Nov 28 17:52:16 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=374b2ddc
7
8 dev-python/notebook: Drop old
9
10 Package-Manager: portage-2.2.20.1
11 RepoMan-Options: --force
12
13 dev-python/notebook/ChangeLog | 8 ++
14 ...k-4.0.4-Don-t-redirect-from-edit-to-files.patch | 55 -------------
15 ...nly-redirect-to-editor-for-text-documents.patch | 38 ---------
16 .../notebook-4.0.4-set-mime-type-on-files.patch | 35 --------
17 ...et-model-mimetype-even-when-content-False.patch | 64 ---------------
18 dev-python/notebook/notebook-4.0.4-r3.ebuild | 93 ----------------------
19 6 files changed, 8 insertions(+), 285 deletions(-)
20
21 diff --git a/dev-python/notebook/ChangeLog b/dev-python/notebook/ChangeLog
22 index be49522..876f16f 100644
23 --- a/dev-python/notebook/ChangeLog
24 +++ b/dev-python/notebook/ChangeLog
25 @@ -2,6 +2,14 @@
26 # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
27 # $Id$
28
29 + 28 Nov 2015; Marius Brehler <marbre@××××××××××××××.de>
30 + -files/notebook-4.0.4-Don-t-redirect-from-edit-to-files.patch,
31 + -files/notebook-4.0.4-only-redirect-to-editor-for-text-documents.patch,
32 + -files/notebook-4.0.4-set-mime-type-on-files.patch,
33 + -files/notebook-4.0.4-set-model-mimetype-even-when-content-False.patch,
34 + -notebook-4.0.4-r3.ebuild:
35 + dev-python/notebook: Drop old
36 +
37 *notebook-4.0.6 (16 Oct 2015)
38
39 16 Oct 2015; Marius Brehler <marbre@××××××××××××××.de> +notebook-4.0.6.ebuild,
40
41 diff --git a/dev-python/notebook/files/notebook-4.0.4-Don-t-redirect-from-edit-to-files.patch b/dev-python/notebook/files/notebook-4.0.4-Don-t-redirect-from-edit-to-files.patch
42 deleted file mode 100644
43 index 76d0e61..0000000
44 --- a/dev-python/notebook/files/notebook-4.0.4-Don-t-redirect-from-edit-to-files.patch
45 +++ /dev/null
46 @@ -1,55 +0,0 @@
47 -Upstream patch to fix
48 -"Maliciously crafted text files in IPython/Jupyter editor".
49 -
50 -http://seclists.org/oss-sec/2015/q3/558
51 -https://bugs.gentoo.org/show_bug.cgi?id=560708
52 -
53 -
54 -From 23162fd2895ad7445fdbe095b8fc8633d95ec6e6 Mon Sep 17 00:00:00 2001
55 -From: Min RK <benjaminrk@×××××.com>
56 -Date: Mon, 20 Jul 2015 12:11:23 -0700
57 -Subject: [PATCH 4/4] Don't redirect from /edit/ to /files/
58 -
59 -show failure to decode, instead
60 ----
61 - notebook/static/edit/js/editor.js | 15 +++------------
62 - 1 file changed, 3 insertions(+), 12 deletions(-)
63 -
64 -diff --git a/notebook/static/edit/js/editor.js b/notebook/static/edit/js/editor.js
65 -index ddbc2de..421fa57 100644
66 ---- a/notebook/static/edit/js/editor.js
67 -+++ b/notebook/static/edit/js/editor.js
68 -@@ -90,19 +90,10 @@ function($,
69 - }).catch(
70 - function(error) {
71 - that.events.trigger("file_load_failed.Editor", error);
72 -- if (((error.xhr||{}).responseJSON||{}).reason === 'bad format') {
73 -- window.location = utils.url_path_join(
74 -- that.base_url,
75 -- 'files',
76 -- that.file_path
77 -- );
78 -- } else {
79 -- console.warn('Error while loading: the error was:')
80 -- console.warn(error)
81 -- }
82 -+ console.warn('Error loading: ', error);
83 - cm.setValue("Error! " + error.message +
84 - "\nSaving disabled.\nSee Console for more details.");
85 -- cm.setOption('readOnly','nocursor')
86 -+ cm.setOption('readOnly','nocursor');
87 - that.save_enabled = false;
88 - }
89 - );
90 -@@ -186,7 +177,7 @@ function($,
91 - Editor.prototype._clean_state = function(){
92 - var clean = this.codemirror.isClean(this.generation);
93 - if (clean === this.clean){
94 -- return
95 -+ return;
96 - } else {
97 - this.clean = clean;
98 - }
99 ---
100 -2.4.6
101 -
102
103 diff --git a/dev-python/notebook/files/notebook-4.0.4-only-redirect-to-editor-for-text-documents.patch b/dev-python/notebook/files/notebook-4.0.4-only-redirect-to-editor-for-text-documents.patch
104 deleted file mode 100644
105 index 899cd31..0000000
106 --- a/dev-python/notebook/files/notebook-4.0.4-only-redirect-to-editor-for-text-documents.patch
107 +++ /dev/null
108 @@ -1,38 +0,0 @@
109 -Upstream patch to fix
110 -"Maliciously crafted text files in IPython/Jupyter editor".
111 -
112 -http://seclists.org/oss-sec/2015/q3/558
113 -https://bugs.gentoo.org/show_bug.cgi?id=560708
114 -
115 -
116 -From 4f0b3b8c10811d460efc67cf61e9f4df83d2a0a7 Mon Sep 17 00:00:00 2001
117 -From: Min RK <benjaminrk@×××××.com>
118 -Date: Mon, 20 Jul 2015 12:11:04 -0700
119 -Subject: [PATCH 3/4] only redirect to editor for text documents
120 -
121 -treat unidentified mime-types as text
122 ----
123 - notebook/static/tree/js/notebooklist.js | 7 +++++++
124 - 1 file changed, 7 insertions(+)
125 -
126 -diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js
127 -index 6308d7f..0b71f42 100644
128 ---- a/notebook/static/tree/js/notebooklist.js
129 -+++ b/notebook/static/tree/js/notebooklist.js
130 -@@ -536,6 +536,13 @@ define([
131 - icon = 'running_' + icon;
132 - }
133 - var uri_prefix = NotebookList.uri_prefixes[model.type];
134 -+ if (model.type === 'file' &&
135 -+ model.mimetype && model.mimetype.substr(0,5) !== 'text/'
136 -+ ) {
137 -+ // send text/unidentified files to editor, others go to raw viewer
138 -+ uri_prefix = 'files';
139 -+ }
140 -+
141 - item.find(".item_icon").addClass(icon).addClass('icon-fixed-width');
142 - var link = item.find("a.item_link")
143 - .attr('href',
144 ---
145 -2.4.6
146 -
147
148 diff --git a/dev-python/notebook/files/notebook-4.0.4-set-mime-type-on-files.patch b/dev-python/notebook/files/notebook-4.0.4-set-mime-type-on-files.patch
149 deleted file mode 100644
150 index 055685f..0000000
151 --- a/dev-python/notebook/files/notebook-4.0.4-set-mime-type-on-files.patch
152 +++ /dev/null
153 @@ -1,35 +0,0 @@
154 -Upstream patch to fix
155 -"Maliciously crafted text files in IPython/Jupyter editor".
156 -
157 -http://seclists.org/oss-sec/2015/q3/558
158 -https://bugs.gentoo.org/show_bug.cgi?id=560708
159 -
160 -
161 -From 6ec427b5234bfc6c97065f130f762aee8ee67df4 Mon Sep 17 00:00:00 2001
162 -From: Min RK <benjaminrk@×××××.com>
163 -Date: Mon, 20 Jul 2015 12:10:10 -0700
164 -Subject: [PATCH 1/4] set mime-type on /files/
165 -
166 ----
167 - notebook/files/handlers.py | 5 +++++
168 - 1 file changed, 5 insertions(+)
169 -
170 -diff --git a/notebook/files/handlers.py b/notebook/files/handlers.py
171 -index def3ec6..9d27261 100644
172 ---- a/notebook/files/handlers.py
173 -+++ b/notebook/files/handlers.py
174 -@@ -40,6 +40,11 @@ class FilesHandler(IPythonHandler):
175 - cur_mime = mimetypes.guess_type(name)[0]
176 - if cur_mime is not None:
177 - self.set_header('Content-Type', cur_mime)
178 -+ else:
179 -+ if model['format'] == 'base64':
180 -+ self.set_header('Content-Type', 'application/octet-stream')
181 -+ else:
182 -+ self.set_header('Content-Type', 'text/plain')
183 -
184 - if model['format'] == 'base64':
185 - b64_bytes = model['content'].encode('ascii')
186 ---
187 -2.4.6
188 -
189
190 diff --git a/dev-python/notebook/files/notebook-4.0.4-set-model-mimetype-even-when-content-False.patch b/dev-python/notebook/files/notebook-4.0.4-set-model-mimetype-even-when-content-False.patch
191 deleted file mode 100644
192 index 46ef427..0000000
193 --- a/dev-python/notebook/files/notebook-4.0.4-set-model-mimetype-even-when-content-False.patch
194 +++ /dev/null
195 @@ -1,64 +0,0 @@
196 -Upstream patch to fix
197 -"Maliciously crafted text files in IPython/Jupyter editor".
198 -
199 -http://seclists.org/oss-sec/2015/q3/558
200 -https://bugs.gentoo.org/show_bug.cgi?id=560708
201 -
202 -
203 -From f64aa490e3574ee2c2b504d0e0b39641c709a34f Mon Sep 17 00:00:00 2001
204 -From: Min RK <benjaminrk@×××××.com>
205 -Date: Mon, 20 Jul 2015 12:10:25 -0700
206 -Subject: [PATCH 2/4] set model mimetype, even when content=False
207 -
208 ----
209 - notebook/services/contents/filemanager.py | 12 +++++++-----
210 - notebook/services/contents/handlers.py | 3 ---
211 - 2 files changed, 7 insertions(+), 8 deletions(-)
212 -
213 -diff --git a/notebook/services/contents/filemanager.py b/notebook/services/contents/filemanager.py
214 -index ff8ac7d..637ff52 100644
215 ---- a/notebook/services/contents/filemanager.py
216 -+++ b/notebook/services/contents/filemanager.py
217 -@@ -278,18 +278,20 @@ class FileContentsManager(FileManagerMixin, ContentsManager):
218 - model['type'] = 'file'
219 -
220 - os_path = self._get_os_path(path)
221 -+ model['mimetype'] = mimetypes.guess_type(os_path)[0]
222 -
223 - if content:
224 - content, format = self._read_file(os_path, format)
225 -- default_mime = {
226 -- 'text': 'text/plain',
227 -- 'base64': 'application/octet-stream'
228 -- }[format]
229 -+ if model['mimetype'] is None:
230 -+ default_mime = {
231 -+ 'text': 'text/plain',
232 -+ 'base64': 'application/octet-stream'
233 -+ }[format]
234 -+ model['mimetype'] = default_mime
235 -
236 - model.update(
237 - content=content,
238 - format=format,
239 -- mimetype=mimetypes.guess_type(os_path)[0] or default_mime,
240 - )
241 -
242 - return model
243 -diff --git a/notebook/services/contents/handlers.py b/notebook/services/contents/handlers.py
244 -index 2a0a4cc..521aae5 100644
245 ---- a/notebook/services/contents/handlers.py
246 -+++ b/notebook/services/contents/handlers.py
247 -@@ -55,9 +55,6 @@ def validate_model(model, expect_content):
248 - )
249 -
250 - maybe_none_keys = ['content', 'format']
251 -- if model['type'] == 'file':
252 -- # mimetype should be populated only for file models
253 -- maybe_none_keys.append('mimetype')
254 - if expect_content:
255 - errors = [key for key in maybe_none_keys if model[key] is None]
256 - if errors:
257 ---
258 -2.4.6
259 -
260
261 diff --git a/dev-python/notebook/notebook-4.0.4-r3.ebuild b/dev-python/notebook/notebook-4.0.4-r3.ebuild
262 deleted file mode 100644
263 index 45820ba..0000000
264 --- a/dev-python/notebook/notebook-4.0.4-r3.ebuild
265 +++ /dev/null
266 @@ -1,93 +0,0 @@
267 -# Copyright 1999-2015 Gentoo Foundation
268 -# Distributed under the terms of the GNU General Public License v2
269 -# $Id$
270 -
271 -EAPI=5
272 -PYTHON_COMPAT=( python2_7 python{3_3,3_4} )
273 -PYTHON_REQ_USE="threads(+)"
274 -
275 -inherit distutils-r1
276 -
277 -DESCRIPTION="Jupyter Interactive Notebook"
278 -HOMEPAGE="http://jupyter.org"
279 -SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
280 -KEYWORDS="~amd64 ~x86"
281 -
282 -LICENSE="BSD"
283 -SLOT="0"
284 -IUSE="doc test"
285 -RDEPEND="
286 - >=dev-libs/mathjax-2.4
287 - dev-python/jinja[${PYTHON_USEDEP}]
288 - >=dev-python/terminado-0.3.3[${PYTHON_USEDEP}]
289 - >=www-servers/tornado-4.0[${PYTHON_USEDEP}]
290 - dev-python/ipython_genutils[${PYTHON_USEDEP}]
291 - dev-python/traitlets[${PYTHON_USEDEP}]
292 - dev-python/jupyter_core[${PYTHON_USEDEP}]
293 - dev-python/jupyter_client[${PYTHON_USEDEP}]
294 - dev-python/nbformat[${PYTHON_USEDEP}]
295 - dev-python/nbconvert[${PYTHON_USEDEP}]
296 - dev-python/ipykernel[${PYTHON_USEDEP}]
297 - "
298 -DEPEND="${RDEPEND}
299 - dev-python/setuptools[${PYTHON_USEDEP}]
300 - test? (
301 - $(python_gen_cond_dep 'dev-python/mock[${PYTHON_USEDEP}]' python2_7)
302 - >=dev-python/nose-0.10.1[${PYTHON_USEDEP}]
303 - dev-python/requests[${PYTHON_USEDEP}]
304 - dev-python/coverage[${PYTHON_USEDEP}]
305 - )
306 - doc? (
307 - app-text/pandoc
308 - >=dev-python/ipython-4.0.0[${PYTHON_USEDEP}]
309 - >=dev-python/sphinx-1.1[${PYTHON_USEDEP}]
310 - )
311 - "
312 -
313 -PATCHES=(
314 - "${FILESDIR}/${P}"-set-mime-type-on-files.patch
315 - "${FILESDIR}/${P}"-set-model-mimetype-even-when-content-False.patch
316 - "${FILESDIR}/${P}"-only-redirect-to-editor-for-text-documents.patch
317 - "${FILESDIR}/${P}"-Don-t-redirect-from-edit-to-files.patch
318 -)
319 -
320 -python_prepare_all() {
321 - sed \
322 - -e "/import setup/s:$:\nimport setuptools:g" \
323 - -i setup.py || die
324 -
325 - # disable bundled mathjax
326 - sed -i 's/^.*MathJax.*$//' bower.json || die
327 - sed -i 's/mj(/#mj(/' setupbase.py || die
328 -
329 - # Prevent un-needed download during build
330 - if use doc; then
331 - sed -e "/^ 'sphinx.ext.intersphinx',/d" -i docs/source/conf.py || die
332 - fi
333 -
334 - distutils-r1_python_prepare_all
335 -}
336 -
337 -python_compile_all() {
338 - use doc && emake -C docs html
339 -}
340 -
341 -python_test() {
342 - nosetests --with-coverage --cover-package=notebook notebook || die
343 -}
344 -
345 -python_install() {
346 - distutils-r1_python_install
347 -
348 - ln -sf "${EPREFIX}/usr/share/mathjax" "${D}$(python_get_sitedir)/notebook/static/components/MathJax" || die
349 -}
350 -
351 -python_install_all() {
352 - use doc && HTML_DOCS=( docs/build/html/. )
353 - distutils-r1_python_install_all
354 -}
355 -
356 -pkg_preinst() {
357 - # remove old mathjax folder if present
358 - rm -rf "${EROOT}"/usr/lib*/python*/site-packages/notebook/static/components/MathJax
359 -}