[med-svn] [python-mne] 01/01: Add patch to use system libs.

Michael Hanke mih at moszumanska.debian.org
Mon Sep 8 11:40:32 UTC 2014


This is an automated email from the git hooks/post-receive script.

mih pushed a commit to branch master
in repository python-mne.

commit 02e0d45685cb13a3fefb4ceedcb30e174c10dba9
Author: Michael Hanke <mih at debian.org>
Date:   Mon Sep 8 13:40:12 2014 +0200

    Add patch to use system libs.
---
 debian/patches/debian_paths | 56 +++++++++++++++++++++++++++++++++++++++++++++
 debian/patches/series       |  1 +
 2 files changed, 57 insertions(+)

diff --git a/debian/patches/debian_paths b/debian/patches/debian_paths
new file mode 100644
index 0000000..1f73199
--- /dev/null
+++ b/debian/patches/debian_paths
@@ -0,0 +1,56 @@
+From: Michael Hanke <michael.hanke at gmail.com>
+Subject: Debian path config for ext. depdendencies
+
+This should deal with the issue of minified javascript libs, by using system
+libs. This does not deal with the missing bootstrap v3 library (the Debian
+package seems stuck on v2).
+
+The idea is to patch upstream to use system libs, whenever they are giving by
+their absolute path.
+
+Additional overhead comes from UTF-8 encoding handling that differs between
+Python 2x and 3x.
+--- a/mne/report.py
++++ b/mne/report.py
+@@ -29,7 +29,7 @@
+ from .externals.decorator import decorator
+ from .externals.tempita import HTMLTemplate, Template
+ from .externals.six import BytesIO
+-from .externals.six import moves
++from .externals.six import moves, PY3
+ 
+ tempdir = _TempDir()
+ temp_fname = op.join(tempdir, 'test')
+@@ -712,21 +712,27 @@
+         """Initialize the renderer.
+         """
+ 
+-        inc_fnames = ['jquery-1.10.2.min.js', 'jquery-ui.min.js',
++        inc_fnames = ['/usr/share/javascript/jquery/jquery.min.js',
++                      '/usr/share/javascript/jquery-ui/jquery-ui.min.js',
+                       'bootstrap.min.js', 'jquery-ui.min.css',
+                       'bootstrap.min.css']
+ 
+         include = list()
+         for inc_fname in inc_fnames:
+             logger.info('Embedding : %s' % inc_fname)
+-            f = open(op.join(op.dirname(__file__), 'html', inc_fname),
+-                     'r')
++            if not os.path.isabs(inc_fname):
++                inc_fname = op.join(op.dirname(__file__), 'html', inc_fname)
++            f = open(inc_fname, 'r')
++            if PY3:
++                f_contents = f.read()
++            else:
++                f_contents = f.read().decode('UTF-8')
+             if inc_fname.endswith('.js'):
+                 include.append(u'<script type="text/javascript">'
+-                               + f.read() + u'</script>')
++                               + f_contents + u'</script>')
+             elif inc_fname.endswith('.css'):
+                 include.append(u'<style type="text/css">'
+-                               + f.read() + u'</style>')
++                               + f_contents + u'</style>')
+             f.close()
+ 
+         self.include = ''.join(include)
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..8702ef2
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+debian_paths

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-mne.git



More information about the debian-med-commit mailing list