Ticket #10192: 10192-remove_dot_from_PYTHONPATH_in_sage-spkg.2.patch

File 10192-remove_dot_from_PYTHONPATH_in_sage-spkg.2.patch, 1.4 KB (added by ppurka, 9 years ago)

Apply only this to SAGE_ROOT

  • spkg/bin/sage-spkg

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1328364589 -3600
    # Node ID 1f7512011f8125ab9c37b1b4474f292f138f7c98
    # Parent  16e41a4141ccbcce359fa06ec08bd9f810cde581
    sage-spkg: Remove current working directory ('.') from PYTHONPATH (cf. also #10176)
    
    diff --git a/spkg/bin/sage-spkg b/spkg/bin/sage-spkg
    a b  
    340340
    341341chmod +x spkg-install
    342342
     343# Remove '.' from PYTHONPATH, which may also come from SAGE_PATH, to avoid
     344# trouble with setuptools / easy_install (cf. #10192, #10176):
     345if [ -n "$PYTHONPATH" ]; then
     346    # We also collapse multiple slashs into a single one (first substitution),
     347    # remove leading './'s and trailing '/.'s (second and third), and
     348    # remove leading, trailing and redundant ':'s (last three substitutions):
     349    new_pp=`echo ":$PYTHONPATH:" \
     350        | sed \
     351        -e 's|//*|/|g' \
     352        -e 's|:\(\./\)\{1,\}|:|g' \
     353        -e 's|\(/\.\)\{1,\}:|:|g' \
     354        -e 's|\(:\.\)\{1,\}:|:|g' \
     355        -e 's|::*|:|g' -e 's|^::*||' -e 's|::*$||'`
     356
     357    if [ "$PYTHONPATH" != "$new_pp" ]; then
     358        echo "Cleaning up PYTHONPATH:"
     359        echo "  Old: \"$PYTHONPATH\""
     360        echo "  New: \"$new_pp\""
     361        PYTHONPATH=$new_pp
     362        export PYTHONPATH # maybe redundant, but in any case safe
     363    fi
     364fi
     365
    343366echo "****************************************************"
    344367echo "Host system"
    345368echo "uname -a:"