Ticket #10192: 10192-remove_dot_from_PYTHONPATH_in_sage-spkg.patch

File 10192-remove_dot_from_PYTHONPATH_in_sage-spkg.patch, 1.4 KB (added by jdemeyer, 9 years ago)
  • spkg/bin/sage-spkg

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1328364589 -3600
    # Node ID 2599ee2f50eaa355425807901fa8fea87eaed1af
    # Parent  ae9b33ad65d983715262ed3dd52a319a07db66e2
    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|:\(\./\)\+|:|g' \
     353                -e 's|\(/\.\)\+:|:|g' \
     354                -e 's|\(:\.\)\+:|:|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:"