Ticket #9191: 9191_run_cython.patch

File 9191_run_cython.patch, 1.5 KB (added by jdemeyer, 9 years ago)
  • sage-run

    # HG changeset patch
    # User Karl-Dieter Crisman <kcrisman@gmail.com>
    # Date 1348603007 14400
    # Node ID f8c272f14fac21f0c51e7d754f8cbc692a736d76
    # Parent  a1202f2260d5eb14623124697b61ed9fc4ebf3d0
    Fix sagex to cython problem, rename sage-sagex as sage-run-cython
    
    diff --git a/sage-run b/sage-run
    a b  
    2222    if call(['sage', '-preparse', fn]) != 0:
    2323        sys.exit(1)
    2424    os.execv(os.path.join(binpath, 'sage-python'), ['sage-python', fn[:-5] + '.py'] + opts)
    25 elif fn.endswith('.spyx'):
    26     os.execv(os.path.join(binpath, 'sage-sagex'), ['sage-sagex', fn] + opts)
     25elif fn.endswith('.pyx') or fn.endswith('.spyx'):
     26    os.execv(os.path.join(binpath, 'sage-run-cython'), ['sage-run-cython', fn] + opts)
    2727else:
    2828    os.execv(os.path.join(binpath, 'sage-python'), ['sage-python', fn] + opts)
  • (a) a/sage-sagex vs. (b) b/sage-run-cython

    diff --git a/sage-sagex b/sage-run-cython
    rename from sage-sagex
    rename to sage-run-cython
    a b  
    11#!/usr/bin/env python
    22
    33import sys
    4 #from sage.all import *
    5 from sage.misc.interpreter import load_sagex
     4from sage.misc.interpreter import load_cython
    65from sage.misc.preparser import preparse
    76from sage.misc.misc import tmp_filename
    87
    98if len(sys.argv) > 1:
    10     try:
    11         s = preparse(load_sagex(sys.argv[1]))
    12         eval(compile(s,tmp_filename(),'exec'))
    13         sys.exit()
    14     except:
    15         sys.exit(1)
     9    s = preparse(load_cython(sys.argv[1]))
     10    eval(compile(s, tmp_filename(), 'exec'))