Ticket #5155: 5155_sagelib.patch

File 5155_sagelib.patch, 2.9 KB (added by jdemeyer, 9 years ago)
  • sage/interfaces/qepcad.py

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1318877612 -7200
    # Node ID 4af3521a79e6406e3932376e548871221c9d0e19
    # Parent  6d54c8dcc3a7ca7a441f8b97d0b4adeecfcb9599
    When doctesting, don't write files in $SAGE_ROOT
    
    diff --git a/sage/interfaces/qepcad.py b/sage/interfaces/qepcad.py
    a b  
    515515    /\
    516516    x^2 - 3 < 0
    517517
     518TESTS:
     519
     520Check the qepcad configuration file::
     521
     522    sage: from sage.misc.misc import SAGE_LOCAL
     523    sage: open('%s/default.qepcadrc'%SAGE_LOCAL).readlines()[-1]
     524    'SINGULAR .../local/bin\n'
     525
    518526AUTHORS:
    519527
    520528- Carl Witty (2008-03): initial version
     
    630638
    631639    _command_info_cache = cache
    632640           
    633 _rewrote_qepcadrc = False
    634 def _rewrite_qepcadrc():
    635     r"""
    636     Write the file \file{default.qepcadrc} to specify a path to Singular
    637     (which QEPCAD uses for Gr\"obner basis computations).
    638 
    639     EXAMPLES:
    640         sage: from sage.interfaces.qepcad import _rewrite_qepcadrc
    641         sage: _rewrite_qepcadrc()
    642         sage: from sage.misc.misc import SAGE_LOCAL
    643         sage: open('%s/default.qepcadrc'%SAGE_LOCAL).readlines()[-1]
    644         'SINGULAR .../bin'
    645     """
    646     global _rewrote_qepcadrc
    647     if _rewrote_qepcadrc: return
    648 
    649     SL = sage.misc.misc.SAGE_LOCAL
    650     fn = '%s/default.qepcadrc'%SL
    651     text = \
    652 """# THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT
    653 
    654 #####################################################
    655 # QEPCAD rc file.
    656 # This file allows for some customization of QEPCADB.
    657 # Right now, the ability to give a path to Singular,
    658 # so that it gets used for some computer algebra
    659 # computations is the only feature.
    660 #####################################################
    661 SINGULAR %s/bin""" % SL
    662 
    663     open(fn, 'w').write(text)
    664 
    665641# QEPCAD does not have a typical "computer algebra system" interaction
    666642# model.  Instead, you run QEPCAD once for each problem you wish to solve,
    667643# then interact with it while you solve that problem.
     
    693669            sage: Qepcad_expect(memcells=100000, logfile=sys.stdout)
    694670            Qepcad
    695671        """
    696         _rewrite_qepcadrc()
    697672        Expect.__init__(self,
    698673                        name="QEPCAD",
    699674                        # yuck: when QEPCAD first starts,
     
    14871462        ...
    14881463        Enter an informal description  between '[' and ']':
    14891464    """
    1490     _rewrite_qepcadrc()
    14911465    # This will only spawn local processes
    14921466    os.system(_qepcad_cmd(memcells))
    14931467
  • sage/misc/session.pyx

    diff --git a/sage/misc/session.pyx b/sage/misc/session.pyx
    a b  
    267267    Something similar happens for cython-defined functions.::
    268268   
    269269        sage: g = cython_lambda('double x', 'x*x + 1.5')
    270         sage: save_session('tmp_f', verbose=True)
     270        sage: save_session(tmp_f, verbose=True)
    271271        Saving...
    272272        Not saving g: g is a function, method, class or type
    273273        ...