Ticket #12719: trac_12719-scripts-vb.patch
File trac_12719-scripts-vb.patch, 3.9 KB (added by , 9 years ago) |
---|
-
deleted file ipy_profile_sage.py
# HG changeset patch # User Volker Braun <vbraun.name@gmail.com> # Date 1358088154 0 # Node ID 168634000025204b35379ad7d3956676e827a5bb # Parent ebb561ac06a10de8ea128c5fe3254bcd9d3b1959 Upgrade scripts to use the IPython 0.13 or later code diff --git a/ipy_profile_sage.py b/ipy_profile_sage.py deleted file mode 100644
+ - 1 import os2 if 'SAGE_CLEAN' not in os.environ:3 import sage.misc.misc4 from sage.misc.interpreter import preparser, _ip5 preparser(True)6 7 import sage.all_cmdline8 sage.all_cmdline._init_cmdline(globals())9 10 _ip.ex('from sage.all import Integer, RealNumber')11 import sage.misc.interpreter12 13 from sage.misc.interpreter import attached_files14 15 branch = sage.misc.misc.branch_current_hg_notice(sage.misc.misc.branch_current_hg())16 if branch:17 print branch18 19 if not os.environ.has_key('SAGE_IMPORTALL') or os.environ['SAGE_IMPORTALL'] != "no":20 _ip.ex('from sage.all_cmdline import *')21 22 startup_file = os.environ.get('SAGE_STARTUP_FILE', '')23 if os.path.exists(startup_file):24 _ip.options.autoexec.append('load %s'%startup_file)25 26 from sage.misc.sage_timeit import sage_timeit27 _ip.expose_magic('timeit', lambda self, s: sage_timeit(s, _ip.user_ns))28 29 from sage.misc.preparser import preparse30 old_prun = _ip.IP.magic_prun31 _ip.expose_magic('prun', lambda self, s: old_prun(preparse(s))) -
sage-doctest
diff --git a/sage-doctest b/sage-doctest
a b 608 608 s += test_code(os.path.abspath(file_name)) 609 609 610 610 # Allow for "sage:" instead of the traditional Python ">>>". 611 s = s.replace("sage:",">>>").replace('_sage"','') 611 prompt_re = re.compile(r'(\n[ \t]*)sage:', re.MULTILINE) 612 s = prompt_re.sub(r'\1>>>', s) 613 s = s.replace('_sage"','') 612 614 613 615 return s 614 616 -
sage-ipython
diff --git a/sage-ipython b/sage-ipython
a b 3 3 """ 4 4 Sage IPython startup script. 5 5 """ 6 7 import os 8 import sys 6 from sage.misc.interpreter import SageTerminalApp 9 7 10 8 # Make sure we're using the Sage profile if one isn't specified. 11 if '-p' not in sys.argv: 12 sys.argv.extend(['-p', 'sage']) 9 import sys 10 if '--profile' not in sys.argv: 11 sys.argv.extend(['--profile', 'sage']) 13 12 14 15 # Import the Sage module before starting IPython, to ensure we import 16 # Sage from the correct directory (in site-packages). 17 # 18 # IPython adds the current working directory to sys.path. If the 19 # current working directory is $SAGE_ROOT/devel/sage, sage would be 20 # imported from $SAGE_ROOT/devel/sage/sage, which is bad for example 21 # because it does not contain the Cython modules. Importing sage before 22 # IPython changes sys.path avoids these problems. 23 import sage 24 25 26 __SAGE_AUTOINJECT__ = True 27 28 import IPython 29 from IPython.CrashHandler import CrashHandler 30 31 ipy_sage = IPython.Shell.start() 32 33 sageCH = CrashHandler(ipy_sage.IP, 'Sage', 'sage-support', 34 'sage-support@googlegroups.com', 35 'http://trac.sagemath.org/sage_trac', 36 'Sage_crash_report.txt', 37 show_crash_traceback=False) 38 39 ipy_sage.IP.set_crash_handler(sageCH) 40 41 import new 42 import os 43 44 old_system = ipy_sage.IP.system 45 46 47 48 sage_commands = os.listdir(os.environ['SAGE_ROOT']+"/local/bin/") 49 DARWIN_SYSTEM = os.uname()[0]=='Darwin' 50 51 def sage_system(self, cmd): 52 if cmd in sage_commands: 53 old_system(cmd) 54 else: 55 libraries = 'LD_LIBRARY_PATH=$$SAGE_ORIG_LD_LIBRARY_PATH;' 56 if DARWIN_SYSTEM: 57 libraries += 'DYLD_LIBRARY_PATH=$$SAGE_ORIG_DYLD_LIBRARY_PATH;' 58 old_system(libraries+cmd) 59 60 ipy_sage.IP.system = new.instancemethod(sage_system, ipy_sage.IP, IPython.iplib.InteractiveShell) 61 62 ipy_sage.mainloop(sys_exit=1, banner='') 13 app = SageTerminalApp.instance() 14 app.initialize() 15 app.start()