Ticket #10192: trac_10192-remove_dot_from_PYTHONPATH_in_sage-spkg-scripts_repo.patch

File trac_10192-remove_dot_from_PYTHONPATH_in_sage-spkg-scripts_repo.patch, 1.4 KB (added by leif, 8 years ago)

Apply to scripts repo. Based on vanilla Sage 4.6.rc0. (Updated version, handles more weird cases, too.)

  • sage-spkg

    # HG changeset patch
    # User Leif Leonhardy <not.really@online.de>
    # Date 1288528802 -3600
    # Node ID bd31f0b222aa04c0edbf59854d4fa7e69779b11f
    # Parent  c234e247a02796299ec674320efd6c39bed1a2c8
    #10192 sage-spkg: Remove '.' (current directory) from PYTHONPATH before installing an spkg (cf. also #10176)
    
    diff -r c234e247a027 -r bd31f0b222aa sage-spkg
    a b  
    292292
    293293chmod +x spkg-install
    294294
     295# Remove '.' from PYTHONPATH, which may also come from SAGE_PATH, to avoid
     296# trouble with setuptools / easy_install (cf. #10192, #10176):
     297if [ -n "$PYTHONPATH" ]; then
     298    # We also remove leading, trailing and redundant ':'s,
     299    # collapse redundant slashs, and replace trailing slashs by '/.':
     300    new_pp=`echo "$PYTHONPATH" | sed -e 's/:\+/:/g' -e 's/^://' -e 's/:$//' \
     301        -e 's/\/\+/\//g' -e 's/\/:/\/.:/g' -e 's/\/$/\/./' \
     302        -e 's/:\(\.\(\/\.\)*:\)\+/:/g' \
     303        -e 's/^\(\.\(\/\.\)*:\)\+//g' -e 's/\(:\.\(\/\.\)*\)\+$//g'`
     304    if [ "$PYTHONPATH" != "$new_pp" ]; then
     305        echo "Cleaning up PYTHONPATH:"
     306        echo "  Old: \"$PYTHONPATH\""
     307        echo "  New: \"$new_pp\""
     308        PYTHONPATH=$new_pp
     309        export PYTHONPATH # maybe redundant, but in any case safe
     310    fi
     311fi
     312
    295313# this is just wrong... (so don't do it)
    296314#echo "TOUCHING"
    297315#touch * */* */*/* */*/*/* 1>/dev/null 2>/dev/null