Ticket #12719: 12719-remove-plugin.patch

File 12719-remove-plugin.patch, 1.9 KB (added by jason, 9 years ago)
  • sage/misc/sage_extension.py

    # HG changeset patch
    # User Jason Grout <jason.grout@drake.edu>
    # Date 1349844259 18000
    # Node ID f70f4656b9f21f3b1e3b7435d34181fd92216d1f
    # Parent  4d6e07d9d3c4a5c83ada4f1df627c8deb1da4e5a
    To be forward compatible with IPython 0.14, we remove our usage of the plugin infrastructure (which is removed in IPython 0.14).
    
    diff --git a/sage/misc/sage_extension.py b/sage/misc/sage_extension.py
    a b  
    1515
    1616from IPython.core.hooks import TryNext
    1717from IPython.core.magic import Magics, magics_class, line_magic
    18 from IPython.core.plugin import Plugin
    1918import os
    2019import sys
    2120import sage
     
    340339#
    341340
    342341
    343 class SagePlugin(Plugin):
     342class SageCustomizations(object):
    344343    startup_code = """from sage.all_cmdline import *
    345344from sage.misc.interpreter import sage_prompt
    346345"""
    347346
    348     def __init__(self, shell=None, config=None):
     347    def __init__(self, shell=None):
    349348        """
    350349        Initialize the Sage plugin.
    351350        """
    352 
    353         super(SagePlugin, self).__init__(shell=shell, config=config)
    354351        self.shell = shell
    355352        self.auto_magics = SageMagics(shell)
    356353        shell.register_magics(self.auto_magics)
    357354        shell.set_hook('pre_run_code_hook', self.auto_magics.pre_run_code_hook)
    358         shell.display_formatter.formatters['text/plain'] = SagePlainTextFormatter(config=config)
     355        shell.display_formatter.formatters['text/plain'] = SagePlainTextFormatter(config=shell.config)
    359356        from sage.misc.edit_module import edit_devel
    360357        self.shell.set_hook('editor', edit_devel)
    361358        self.init_inspector()
     
    491488@run_once
    492489def load_ipython_extension(ip):
    493490    """Load the extension in IPython."""
    494     plugin = SagePlugin(shell=ip, config=ip.config)
    495     ip.plugin_manager.register_plugin('sage', plugin)
     491    # this modifies ip
     492    SageCustomizations(shell=ip)