Ticket #6235: trac_6235-MPLCONFIGDIR.patch

File trac_6235-MPLCONFIGDIR.patch, 1.7 KB (added by jhpalmieri, 10 years ago)

scripts repo

  • sage-env

    # HG changeset patch
    # User J. H. Palmieri <palmieri@math.washington.edu>
    # Date 1287624877 25200
    # Node ID cc68f144611ece3768c27e0cf71cdb01590f1fa1
    # Parent  1c20d7c674d6d841db63c877a8c5f07c735cf9ed
    #6235: use matplotlib config dir whose name depends on the version of matplotlib
    
    diff -r 1c20d7c674d6 -r cc68f144611e sage-env
    a b if [ -z "$SAGE_TESTDIR" ]; then 
    182182    SAGE_TESTDIR="$DOT_SAGE"/tmp && export SAGE_TESTDIR
    183183fi
    184184
     185# Use a matplotlib config directory specific to Sage and specific to
     186# the version number of matplotlib, by setting the environment
     187# variable MPLCONFIGDIR.  See
     188# http://trac.sagemath.org/sage_trac/ticket/6235 and
     189# http://trac.sagemath.org/sage_trac/ticket/9221.  Find the version
     190# number for matplotlib by reading the file
     191# SAGE_LOCAL/lib/python/site-packages/matplotlib/__init__.py, and use
     192# the version number in the name of the directory.  If that file
     193# doesn't exist, matplotlib hasn't been installed yet, so don't set
     194# MPLCONFIGDIR.
     195MPLINITFILE="$SAGE_LOCAL/lib/python/site-packages/matplotlib/__init__.py"
     196if [ -f "$MPLINITFILE" ]; then
     197    MPLVERSION=`sed -n "/^__version__[ ]*=/s/[^']*'\([^']*\)'.*$/\1/p" "$MPLINITFILE"`
     198    if [ "$MPLVERSION" != "" ]; then
     199        MPLCONFIGDIR="$DOT_SAGE/matplotlib-$MPLVERSION"
     200    else
     201        # MPLVERSION is empty, so no version found.
     202        MPLCONFIGDIR="$DOT_SAGE/matplotlib"
     203    fi
     204    export MPLCONFIGDIR
     205    # Create the directory, because matplotlib doesn't seem to be happy otherwise.
     206    mkdir -p "$MPLCONFIGDIR"
     207fi
     208
    185209LD_LIBRARY_PATH="$SAGE_ROOT/local/lib/:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH
    186210# The following is needed for openmpi:
    187211LD_LIBRARY_PATH="$SAGE_ROOT/local/lib/openmpi:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH