diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-07-19 01:11:44 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-07-19 01:11:44 -0300 |
commit | 9ff016d27648c59ac7d9bb4bc5f6dd52f450c5ce (patch) | |
tree | 669bde8535392ec19a648b26c328967dcdde7465 | |
parent | afe3f8f4b39a6684cf11147c46be3b728177b7cf (diff) | |
download | abslibre-9ff016d27648c59ac7d9bb4bc5f6dd52f450c5ce.tar.gz abslibre-9ff016d27648c59ac7d9bb4bc5f6dd52f450c5ce.tar.bz2 abslibre-9ff016d27648c59ac7d9bb4bc5f6dd52f450c5ce.zip |
sagemath-7.2-7.parabola1: port to ipython 5.0
-rw-r--r-- | libre/sagemath/PKGBUILD | 22 | ||||
-rw-r--r-- | libre/sagemath/sagemath-ipython5.patch | 120 |
2 files changed, 127 insertions, 15 deletions
diff --git a/libre/sagemath/PKGBUILD b/libre/sagemath/PKGBUILD index b770aca09..45d2b5e47 100644 --- a/libre/sagemath/PKGBUILD +++ b/libre/sagemath/PKGBUILD @@ -1,4 +1,4 @@ -# $Id: PKGBUILD 180713 2016-06-21 22:35:27Z arojas $ +# $Id: PKGBUILD 183005 2016-07-16 21:09:23Z arojas $ # Maintainer (Arch): Evgeniy Alekseev <arcanis.arch at gmail dot com> # Maintainer (Arch): Antonio Rojas <arojas@archlinux.org> # Contributor (Arch): Daniel Wallace <danielwallace at gtmanfred dot com> @@ -11,7 +11,7 @@ pkgname=sagemath pkgver=7.2 -pkgrel=6.parabola1 +pkgrel=7.parabola1 pkgdesc="Free Mathematics Software, free software replacement of Magma, Maple, Mathematica, and Matlab, without nonfree nauty support" arch=(i686 x86_64 armv7h) url="http://www.sagemath.org" @@ -36,11 +36,9 @@ conflicts=(sage-mathematics) replaces=(sage-mathematics) provides=(sage-mathematics) source=("$pkgname-$pkgver.tar.gz::https://github.com/sagemath/sage/archive/$pkgver.tar.gz" - pexpect.zip::"https://github.com/pexpect/pexpect/archive/524495960dd8898ddd30f7ba37298de51beee773.zip" anal.h env.patch paths.patch clean.patch skip-check.patch cython-sys-path.patch is-package-installed.patch package.patch - disable-fes.patch jupyter-path.patch test-optional.patch python-2.7.11.patch linbox-1.4.patch ecm-7.patch) + disable-fes.patch jupyter-path.patch test-optional.patch python-2.7.11.patch linbox-1.4.patch ecm-7.patch sagemath-ipython5.patch) md5sums=('2afeb8f75a33107fef5d509698c0eabc' - 'a346bb2c0350c1cb17d5325235c5e38a' 'a906a180d198186a39820b0a2f9a9c63' 'f6c62f0ccc168c5e6e3dd9d6f73f6389' '52d30e91110183489f66d7bf73c36c64' @@ -54,7 +52,8 @@ md5sums=('2afeb8f75a33107fef5d509698c0eabc' 'cdcabd475b80afe0534a5621e972736e' 'ef927896f2071b442b1d07d7e69f5f3a' '9f1cef3e477bafebe2ad301db56db8a2' - '0c9a57d35de80c2cd418ebec912efbbb') + '0c9a57d35de80c2cd418ebec912efbbb' + '55e75afd249048a8718c4377c22afa52') prepare(){ cd sage-$pkgver @@ -96,6 +95,8 @@ prepare(){ patch -p0 -i ../disable-fes.patch # port to new givaro/fflas-ffpack/linbox http://trac.sagemath.org/ticket/17635 patch -p1 -i ../linbox-1.4.patch +# port to ipython 5.0 https://trac.sagemath.org/ticket/21006 + patch -p1 -i ../sagemath-ipython5.patch # replace is_package_installed usage http://trac.sagemath.org/ticket/20377 patch -p1 -i ../is-package-installed.patch @@ -126,9 +127,6 @@ build() { make sage/ext/interpreters/__init__.py python2 setup.py build - - cd "$srcdir"/pexpect-* - python2 setup.py build } package() { @@ -160,10 +158,4 @@ package() { # Remove sage_setup rm -r "$pkgdir"/usr/lib/python2.7/site-packages/sage_setup - -# install pexpect - cd "$srcdir"/pexpect-* - python2 setup.py install --root="$pkgdir" --optimize=1 - mkdir -p "$pkgdir"/usr/lib/sage/site-packages/ - mv "$pkgdir"/usr/lib/python2.7/site-packages/pexpect "$pkgdir"/usr/lib/sage/site-packages/ } diff --git a/libre/sagemath/sagemath-ipython5.patch b/libre/sagemath/sagemath-ipython5.patch new file mode 100644 index 000000000..6d8557175 --- /dev/null +++ b/libre/sagemath/sagemath-ipython5.patch @@ -0,0 +1,120 @@ +diff --git a/src/sage/repl/interpreter.py b/src/sage/repl/interpreter.py +index ef8724d..6896985 100644 +--- a/src/sage/repl/interpreter.py ++++ b/src/sage/repl/interpreter.py +@@ -103,6 +103,7 @@ import os + import re + import sys + from sage.repl.preparse import preparse ++from sage.repl.prompts import SagePrompts, InterfacePrompts + + from traitlets.config.loader import Config + from traitlets import Bool, Type +@@ -371,11 +372,6 @@ class SageTestShell(SageShellOverride, TerminalInteractiveShell): + ################################################################### + + DEFAULT_SAGE_CONFIG = Config( +- PromptManager = Config( +- in_template = 'sage: ', +- in2_template = '....: ', +- justify = False, +- out_template = ''), + TerminalIPythonApp = Config( + display_banner = False, + verbose_crash = True, +@@ -383,6 +379,7 @@ DEFAULT_SAGE_CONFIG = Config( + shell_class = SageTerminalInteractiveShell, + ), + InteractiveShell = Config( ++ prompts_class = SagePrompts, + ast_node_interactivity = 'all', + colors = 'LightBG' if sys.stdout.isatty() else 'NoColor', + confirm_exit = False, +@@ -616,13 +613,11 @@ def interface_shell_embed(interface): + cfg = copy.deepcopy(get_ipython().config) + except NameError: + cfg = copy.deepcopy(DEFAULT_SAGE_CONFIG) +- cfg.PromptManager['in_template'] = interface.name() + ': ' +- cfg.PromptManager['in2_template'] = len(interface.name())*'.' + ': ' +- + ipshell = InteractiveShellEmbed(config=cfg, + banner1='\n --> Switching to %s <--\n\n'%interface, + exit_msg = '\n --> Exiting back to Sage <--\n') + ipshell.interface = interface ++ ipshell.prompts = InterfacePrompts(interface.name()) + + while ipshell.prefilter_manager.transformers: + ipshell.prefilter_manager.transformers.pop() +diff --git a/src/sage/repl/prompts.py b/src/sage/repl/prompts.py +new file mode 100644 +index 0000000..69f8cdd +--- /dev/null ++++ b/src/sage/repl/prompts.py +@@ -0,0 +1,67 @@ ++r""" ++Sage Commandline Prompts ++""" ++ ++#***************************************************************************** ++# Copyright (C) 2016 Volker Braun <vbraun.name@gmail.com> ++# ++# This program is free software: you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation, either version 2 of the License, or ++# (at your option) any later version. ++# http://www.gnu.org/licenses/ ++#***************************************************************************** ++ ++from pygments.token import Token ++from IPython.terminal.prompts import Prompts ++ ++ ++class SagePrompts(Prompts): ++ ++ def in_prompt_tokens(self, cli=None): ++ return [ ++ (Token.Prompt, 'sage: '), ++ ] ++ ++ def continuation_prompt_tokens(self, cli=None, width=None): ++ return [ ++ (Token.Prompt, '....: '), ++ ] ++ ++ def rewrite_prompt_tokens(self): ++ return [ ++ (Token.Prompt, '----> '), ++ ] ++ ++ def out_prompt_tokens(self): ++ return [ ++ (Token.OutPrompt, ''), ++ ] ++ ++ ++class InterfacePrompts(Prompts): ++ ++ def __init__(self, interface_name): ++ self.__name = interface_name ++ self.__width = len(interface_name) ++ ++ def in_prompt_tokens(self, cli=None): ++ return [ ++ (Token.Prompt, self.__name + ': '), ++ ] ++ ++ def continuation_prompt_tokens(self, cli=None, width=None): ++ return [ ++ (Token.Prompt, '.' * self.__width + ': '), ++ ] ++ ++ def rewrite_prompt_tokens(self): ++ return [ ++ (Token.Prompt, '-' * self.__width + '> '), ++ ] ++ ++ def out_prompt_tokens(self): ++ return [ ++ (Token.OutPrompt, ''), ++ ] ++ |