Ticket #11887: trac_11887-cython.patch

File trac_11887-cython.patch, 2.4 KB (added by John Palmieri, 11 years ago)
  • sage/misc/cython.py

    # HG changeset patch
    # User Leif Leonhardy <not.really@online.de>, J. H. Palmieri <palmieri@math.washington.edu>
    # Date 1317498155 25200
    # Node ID f61cf61662aabee47f3544761ed8133a90bf02f8
    # Parent  8a0b4f90f1ca76dbdba159897c39209c5da85442
    #11887: don't create .c and .html files when running "compile_and_load"
    
    diff --git a/sage/misc/cython.py b/sage/misc/cython.py
    a b sequence_number = {} 
    257257def cython(filename, verbose=False, compile_message=False,
    258258           use_cache=False, create_local_c_file=False, annotate=True, sage_namespace=True,
    259259           create_local_so_file=False):
     260    """
     261    TODO: document this function!
     262    """
    260263    if not filename.endswith('pyx'):
    261264        print "File (=%s) should have extension .pyx"%filename
    262265
    def compile_and_load(code): 
    627630    file = tmp_filename() + ".pyx"
    628631    open(file,'w').write(code)
    629632    from sage.server.support import cython_import
    630     return cython_import(file)
     633    return cython_import(file, create_local_c_file=False)
    631634
    632635
    633636TESTS = {
  • sage/server/support.py

    diff --git a/sage/server/support.py b/sage/server/support.py
    a b import sys 
    426426import __builtin__
    427427
    428428def cython_import(filename, verbose=False, compile_message=False,
    429                  use_cache=False, create_local_c_file=True):
     429                 use_cache=False, create_local_c_file=True, **kwds):
    430430    """
    431431    Compile a file containing Cython code, then import and return the
    432432    module.  Raises an ``ImportError`` if anything goes wrong.
    def cython_import(filename, verbose=Fals 
    435435   
    436436    - ``filename`` - a string; name of a file that contains Cython
    437437      code
    438    
     438
     439    See the function :func:`sage.misc.cython.cython` for documentation
     440    for the other inputs.
     441
    439442    OUTPUT:
    440    
     443
    441444    - the module that contains the compiled Cython code.
    442445    """
    443446    name, build_dir = sage.misc.cython.cython(filename, verbose=verbose,
    444447                                            compile_message=compile_message,
    445448                                            use_cache=use_cache,
    446                                             create_local_c_file=create_local_c_file)
     449                                            create_local_c_file=create_local_c_file,
     450                                            **kwds)
    447451    sys.path.append(build_dir)
    448452    return __builtin__.__import__(name)
    449453