#9386: sage-native-execute leaves traces of sage
-------------------------------------+-------------------------------------
       Reporter:  nbruin             |        Owner:  tbd
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.4
      Component:  packages:          |   Resolution:
  standard                           |    Merged in:
       Keywords:                     |    Reviewers:
        Authors:  Thierry Monteil    |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  920c897ec3c439d772f7dfef1a420fb9aec0baea
  u/tmonteil/sage_native_execute_leaves_traces_of_sage|     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------

Comment (by tmonteil):

 After quite some work, the following seems to work (and let us love
 Python):

 {{{

 sage_export () {
     if [ $(echo "${SAGE_SAVED_ENVIRONMENT_VARIABLES}" | grep -c " ${1} ")
 = 0 ] ; then
         SAGE_SAVED_ENVIRONMENT_VARIABLES+=" ${1} "
         if [ -z "${!1+set}" ] ; then
             declare -g SAGE_SAVED_${1}='sage_unset'
         else
             declare -g SAGE_SAVED_${1}=${!1}
         fi
     fi
     declare -g ${1}=${2}
     export ${1}
     export SAGE_SAVED_${1}
     export SAGE_SAVED_ENVIRONMENT_VARIABLES
 }


 sage_clean () {
     for VARIABLE in ${SAGE_SAVED_ENVIRONMENT_VARIABLES} ; do
         declare SAGE_TMP_VAR_NAME=SAGE_SAVED_${VARIABLE}
         if [ "${!SAGE_TMP_VAR_NAME}" = 'sage_unset' ] ; then
             unset ${VARIABLE}
         else
             declare -g ${VARIABLE}=${!SAGE_TMP_VAR_NAME}
             export ${VARIABLE}
         fi
         unset ${SAGE_TMP_VAR_NAME}
     done
     unset SAGE_SAVED_ENVIRONMENT_VARIABLES
 }

 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/9386#comment:13>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to