From a23cc82c6ce470afd44d941e42b992995c27446d Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Thu, 19 Feb 2015 13:31:00 +0100 Subject: [PATCH] New package: python-ipython-2.4.1 --- srcpkgs/python-ipython-notebook | 1 + srcpkgs/python-ipython-qtconsole | 1 + srcpkgs/python-ipython/INSTALL.msg | 8 ++ .../python-ipython/patches/split-pkg.patch | 32 +++++ .../patches/use-system-mathjax.patch | 25 ++++ .../python3.4-ipython.INSTALL.msg | 9 ++ srcpkgs/python-ipython/template | 126 ++++++++++++++++++ srcpkgs/python3.4-ipython | 1 + srcpkgs/python3.4-ipython-notebook | 1 + srcpkgs/python3.4-ipython-qtconsole | 1 + 10 files changed, 205 insertions(+) create mode 120000 srcpkgs/python-ipython-notebook create mode 120000 srcpkgs/python-ipython-qtconsole create mode 100644 srcpkgs/python-ipython/INSTALL.msg create mode 100644 srcpkgs/python-ipython/patches/split-pkg.patch create mode 100644 srcpkgs/python-ipython/patches/use-system-mathjax.patch create mode 100644 srcpkgs/python-ipython/python3.4-ipython.INSTALL.msg create mode 100644 srcpkgs/python-ipython/template create mode 120000 srcpkgs/python3.4-ipython create mode 120000 srcpkgs/python3.4-ipython-notebook create mode 120000 srcpkgs/python3.4-ipython-qtconsole diff --git a/srcpkgs/python-ipython-notebook b/srcpkgs/python-ipython-notebook new file mode 120000 index 00000000000..3c02370e4b5 --- /dev/null +++ b/srcpkgs/python-ipython-notebook @@ -0,0 +1 @@ +python-ipython \ No newline at end of file diff --git a/srcpkgs/python-ipython-qtconsole b/srcpkgs/python-ipython-qtconsole new file mode 120000 index 00000000000..3c02370e4b5 --- /dev/null +++ b/srcpkgs/python-ipython-qtconsole @@ -0,0 +1 @@ +python-ipython \ No newline at end of file diff --git a/srcpkgs/python-ipython/INSTALL.msg b/srcpkgs/python-ipython/INSTALL.msg new file mode 100644 index 00000000000..d2f8c95061b --- /dev/null +++ b/srcpkgs/python-ipython/INSTALL.msg @@ -0,0 +1,8 @@ +This package contains the basic ipython terminal shell. + +For the Qt console install python-ipython-qtconsole. +For the HTML notebook install python-ipython-notebook. +For the matplotlib integration install python-matplotlib. + +To convert notebooks between various formats install the following +dependencies: python-Jinja2, python-Pygments, python-Sphinx, pandoc. diff --git a/srcpkgs/python-ipython/patches/split-pkg.patch b/srcpkgs/python-ipython/patches/split-pkg.patch new file mode 100644 index 00000000000..7687f7bafe0 --- /dev/null +++ b/srcpkgs/python-ipython/patches/split-pkg.patch @@ -0,0 +1,32 @@ +Description: don't fail startup if ipython-notebook is not installed + e.g. ipython locate triggers this code but doesn't need the notebook css files +--- IPython/core/profiledir.py ++++ IPython/core/profiledir.py +@@ -173,15 +173,18 @@ class ProfileDir(LoggingConfigurable): + self._mkdir(self.static_dir) + custom = os.path.join(self.static_dir, 'custom') + self._mkdir(custom) +- from IPython.html import DEFAULT_STATIC_FILES_PATH +- for fname in ('custom.js', 'custom.css'): +- src = os.path.join(DEFAULT_STATIC_FILES_PATH, 'custom', fname) +- dest = os.path.join(custom, fname) +- if not os.path.exists(src): +- self.log.warn("Could not copy default file to static dir. Source file %s does not exist.", src) +- continue +- if not os.path.exists(dest): +- shutil.copy(src, dest) ++ try: ++ from IPython.html import DEFAULT_STATIC_FILES_PATH ++ for fname in ('custom.js', 'custom.css'): ++ src = os.path.join(DEFAULT_STATIC_FILES_PATH, 'custom', fname) ++ dest = os.path.join(custom, fname) ++ if not os.path.exists(src): ++ self.log.warn("Could not copy default file to static dir. Source file %s does not exist.", src) ++ continue ++ if not os.path.exists(dest): ++ shutil.copy(src, dest) ++ except ImportError: ++ pass # ipython-notebook not installed + + def check_dirs(self): + self.check_security_dir() diff --git a/srcpkgs/python-ipython/patches/use-system-mathjax.patch b/srcpkgs/python-ipython/patches/use-system-mathjax.patch new file mode 100644 index 00000000000..949d996b874 --- /dev/null +++ b/srcpkgs/python-ipython/patches/use-system-mathjax.patch @@ -0,0 +1,25 @@ +--- IPython/html/notebookapp.py ++++ IPython/html/notebookapp.py +@@ -218,6 +218,11 @@ class NotebookWebApplication(web.Applica + pattern = url_path_join(settings['base_url'], handler[0]) + new_handler = tuple([pattern] + list(handler[1:])) + new_handlers.append(new_handler) ++ ++ if os.path.exists("/usr/share/mathjax/MathJax.js"): ++ new_handlers.append((r"/mathjax/(.*)", web.StaticFileHandler, ++ {"path": "/usr/share/mathjax"})) ++ + # add 404 on the end, which will catch everything that falls through + new_handlers.append((r'(.*)', Template404)) + return new_handlers +@@ -514,6 +519,10 @@ class NotebookApp(BaseIPythonApplication + url = url_path_join(url_prefix, u"mathjax/MathJax.js") + self.log.info("Serving local MathJax from %s at %s", mathjax, url) + return url ++ ++ if os.path.exists("/usr/share/mathjax/MathJax.js"): ++ self.log.info("Using system MathJax") ++ return u"/mathjax/MathJax.js" + + # no local mathjax, serve from CDN + url = u"https://cdn.mathjax.org/mathjax/latest/MathJax.js" diff --git a/srcpkgs/python-ipython/python3.4-ipython.INSTALL.msg b/srcpkgs/python-ipython/python3.4-ipython.INSTALL.msg new file mode 100644 index 00000000000..19c86a7a921 --- /dev/null +++ b/srcpkgs/python-ipython/python3.4-ipython.INSTALL.msg @@ -0,0 +1,9 @@ +This package contains the Python 3 variant of ipython terminal shell. + +For the Qt console install python3.4-ipython-qtconsole. +For the HTML notebook install python3.4-ipython-notebook. +For the matplotlib integration install python3.4-matplotlib. + +To convert notebooks between various formats install the following +dependencies: python3.4-Jinja2, python3.4-Pygments, python3.4-Sphinx, +pandoc. diff --git a/srcpkgs/python-ipython/template b/srcpkgs/python-ipython/template new file mode 100644 index 00000000000..5013a8a4a0e --- /dev/null +++ b/srcpkgs/python-ipython/template @@ -0,0 +1,126 @@ +# Template file for 'python-ipython' +pkgname=python-ipython +version=2.4.1 +revision=1 +noarch=yes +wrksrc="ipython-${version}" +build_style=python-module +python_versions="2.7 3.4" +hostmakedepends=" + python-setuptools python3.4-setuptools python-Sphinx python3.4-Sphinx + python-Pygments python3.4-Pygments python-tornado python3.4-tornado + python-Jinja2 python3.4-Jinja2 python-pyzmq python3.4-pyzmq python-pexpect + python3.4-pexpect" +makedepends="${hostmakedepends}" +depends="python-decorator python-jsonpointer python-jsonschema python-path + python-pexpect python-simplegeneric" +pycompile_module="IPython" +short_desc="Enhanced interactive Python2 shell" +_short_desc="${short_desc/Python2/Python3.4}" +maintainer="Alessio Sergi " +homepage="http://ipython.org/" +license="3-clause-BSD" +distfiles="${PYPI_SITE}/i/ipython/ipython-${version}.tar.gz" +checksum=6d350b5c2d3e925b0ff6167658812d720b891e476238d924504e2f7f483e9217 + +# explicit order, do not change +subpackages="python-ipython-notebook python3.4-ipython-notebook python3.4-ipython" +if [ -z "$CROSS_BUILD" ]; then + subpackages+=" python-ipython-qtconsole python3.4-ipython-qtconsole" +fi + +pre_build() { + # remove shebangs + find IPython -type f -name '*.py' -exec sed -i '/^#!.*python$/d' {} + + + # rename man pages + for f in docs/man/*; do + cp ${f} ${f/%.1/3.1} + done +} +post_install() { + # remove bundled libraries + for f in decorator{,s} json{pointer,schema} path pexpect simplegeneric; do + find ${DESTDIR} -type f -name _${f}.py -delete + done + + # remove qtconsole + rm -rf ${DESTDIR}/usr/lib/python*/site-packages/IPython/qt + + # drop '2' suffix from bin names + for f in ${DESTDIR}/usr/bin/*2; do + mv ${f} ${f/%2/} + done + + # install qtconsole.desktop files + if [ -z "$CROSS_BUILD" ]; then + install -Dm644 "${wrksrc}/examples/IPython Kernel/ipython-qtconsole.desktop" \ + ${DESTDIR}/usr/share/applications/ipython-qtconsole.desktop + sed -i 's/ipython/&3/g;s/IPython/&3/g' "${wrksrc}/examples/IPython Kernel/ipython-qtconsole.desktop" + install -Dm644 "${wrksrc}/examples/IPython Kernel/ipython-qtconsole.desktop" \ + ${DESTDIR}/usr/share/applications/ipython3-qtconsole.desktop + fi + + # install license + vlicense COPYING.rst LICENSE +} + +python-ipython-notebook_package() { + noarch=yes + depends="${sourcepkg}>=${version}_${revision} python-pyzmq python-Jinja2 + python-tornado mathjax" + short_desc+=" - HTML notebook" + pycompile_module="IPython" + pkg_install() { + vmove usr/lib/python2.7/site-packages/IPython/html + } +} +python-ipython-qtconsole_package() { + noarch=yes + depends="${sourcepkg}>=${version}_${revision} python-pyzmq python-Pygments + python-PyQt4 desktop-file-utils" + short_desc+=" - Qt console" + pycompile_module="IPython" + pkg_install() { + vmkdir usr/lib/python2.7/site-packages/IPython + vcopy ${wrksrc}/IPython/qt usr/lib/python2.7/site-packages/IPython + vmove usr/share/applications/ipython-qtconsole.desktop + } +} +python3.4-ipython_package() { + noarch=yes + depends="python3.4-decorator python3.4-jsonpointer python3.4-jsonschema + python3.4-path python3.4-pexpect python3.4-simplegeneric" + short_desc="${_short_desc}" + pycompile_version="3.4" + pycompile_module="IPython" + pkg_install() { + vmove usr/bin/*3 + vmove usr/lib/python3.4 + vmove usr/share/man/man1/*3.1 + vlicense ${wrksrc}/COPYING.rst LICENSE + } +} +python3.4-ipython-notebook_package() { + noarch=yes + depends="python3.4-ipython>=${version}_${revision} python3.4-pyzmq + python3.4-Jinja2 python3.4-tornado mathjax" + short_desc="${_short_desc} - HTML notebook" + pycompile_module="IPython" + pkg_install() { + vmove usr/lib/python3.4/site-packages/IPython/html + } +} +python3.4-ipython-qtconsole_package() { + noarch=yes + depends="python3.4-ipython>=${version}_${revision} python3.4-pyzmq + python3.4-Pygments python3.4-PyQt4 desktop-file-utils" + short_desc="${_short_desc} - Qt console" + pycompile_version="3.4" + pycompile_module="IPython" + pkg_install() { + vmkdir usr/lib/python3.4/site-packages/IPython + vcopy ${wrksrc}/IPython/qt usr/lib/python3.4/site-packages/IPython + vmove usr/share/applications/ipython3-qtconsole.desktop + } +} diff --git a/srcpkgs/python3.4-ipython b/srcpkgs/python3.4-ipython new file mode 120000 index 00000000000..3c02370e4b5 --- /dev/null +++ b/srcpkgs/python3.4-ipython @@ -0,0 +1 @@ +python-ipython \ No newline at end of file diff --git a/srcpkgs/python3.4-ipython-notebook b/srcpkgs/python3.4-ipython-notebook new file mode 120000 index 00000000000..3c02370e4b5 --- /dev/null +++ b/srcpkgs/python3.4-ipython-notebook @@ -0,0 +1 @@ +python-ipython \ No newline at end of file diff --git a/srcpkgs/python3.4-ipython-qtconsole b/srcpkgs/python3.4-ipython-qtconsole new file mode 120000 index 00000000000..3c02370e4b5 --- /dev/null +++ b/srcpkgs/python3.4-ipython-qtconsole @@ -0,0 +1 @@ +python-ipython \ No newline at end of file