Ticket #13147: trac_13147-ref.patch

File trac_13147-ref.patch, 3.7 KB (added by jhpalmieri, 8 years ago)
  • sage/interfaces/expect.py

    # HG changeset patch
    # User J. H. Palmieri <palmieri@math.washington.edu>
    # Date 1350591395 25200
    # Node ID fc5fa5999059ba418cbd64ab4759a6b61c8153fa
    # Parent  1a559058a620acd6eb42ca92f06fc515eb0b4c9c
    Docstring rewordings in lazy_string.py, fix for defn of SPYX_TMP
    and usage of SAGE_TMP_INTERFACE
    
    diff --git a/sage/interfaces/expect.py b/sage/interfaces/expect.py
    a b BAD_SESSION = -2 
    7272
    7373failed_to_start = []
    7474
    75 #tmp_expect_interface_local='%s/tmp'%SAGE_TMP_INTERFACE
    76 
    77 #def tmp_expect_interface_local():
    78 #    return '%s/tmp'%SAGE_TMP_INTERFACE + str(os.getpid())
    79 
    80 ## On some platforms, e.g., windows, this can easily take 10 seconds!?!  Terrible.  And
    81 ## it should not be necessary or used anyways.
    82 ## def _absolute(cmd):
    83 ##     c = cmd.split()
    84 ##     s  = c[0]
    85 ##     t = os.popen('which %s'%s).read().strip()
    86 ##     if len(t) == 0:
    87 ##         raise RuntimeError
    88 ##     return ' '.join([t] + c[1:])
    89 
    9075# The subprocess is a shared resource.  In a multi-threaded
    9176# environment, there would have to be a lock to control access to the
    9277# subprocess.  Fortunately, Sage does not use Python threads.
    If this all works, you can then make cal 
    587572        - Simon King (2010-09): Making the tmp-file unique for the interface instance
    588573
    589574        """
    590         #return '%s/tmp'%SAGE_TMP_INTERFACE + str(self.pid())
    591575        try:
    592576            return self.__local_tmpfile
    593577        except AttributeError:
    594             self.__local_tmpfile = '%s/tmp'%SAGE_TMP_INTERFACE + str(self.pid())
     578            self.__local_tmpfile = os.path.join(SAGE_TMP_INTERFACE, 'tmp' + str(self.pid()))
    595579            return self.__local_tmpfile
    596580
    597581    def _remote_tmpdir(self):
  • sage/misc/cython.py

    diff --git a/sage/misc/cython.py b/sage/misc/cython.py
    a b def cython(filename, verbose=False, comp 
    373373    # This is the *temporary* directory where we build the pyx file.
    374374    # This is deleted when sage exits, which means pyx files must be
    375375    # rebuilt every time Sage is restarted at present.
    376     build_dir = '%s/%s'%(SPYX_TMP, base)
     376    build_dir = os.path.join(SPYX_TMP, base)
    377377
    378378    if os.path.exists(build_dir):
    379379        # There is already a module here. Maybe we do not have to rebuild?
  • sage/misc/lazy_string.py

    diff --git a/sage/misc/lazy_string.py b/sage/misc/lazy_string.py
    a b Based on speaklater: https://github.com/ 
    66
    77A lazy string is an object that behaves almost exactly like a string
    88but where the value is not computed until needed.  To define a lazy
    9 you specify a function that produces a string together with the
     9string you specify a function that produces a string together with the
    1010appropriate arguments for that function.  Sage uses lazy strings in
    1111:mod:`sage.misc.misc` so that the filenames for SAGE_TMP (which
    12 depends on the pid of the process running Sage) is not computed when
     12depends on the pid of the process running Sage) are not computed when
    1313importing the Sage library.  This means that when the doctesting code
    1414imports the Sage library and then forks, the variable SAGE_TMP depends
    1515on the new pid rather than the old one.
  • sage/misc/misc.py

    diff --git a/sage/misc/misc.py b/sage/misc/misc.py
    a b def SAGE_TMP(): 
    152152    sage_makedirs(d)
    153153    return d
    154154
    155 SPYX_TMP = os.path.join(SAGE_TMP, 'spyx/')
    156155@lazy_string
    157156def SPYX_TMP():
    158157    """
    def SPYX_TMP(): 
    160159
    161160        sage: from sage.misc.misc import SPYX_TMP
    162161        sage: SPYX_TMP
    163         l'.../temp/.../spyx/'
     162        l'.../temp/.../spyx'
    164163    """
    165     return os.path.join(SAGE_TMP, 'spyx', os.sep)
     164    return os.path.join(SAGE_TMP, 'spyx')
    166165
    167166@lazy_string
    168167def SAGE_TMP_INTERFACE():