Ticket #10192: trac_10192-remove_dot_from_PYTHONPATH_in_sage-spkg.v3.scripts.patch

File trac_10192-remove_dot_from_PYTHONPATH_in_sage-spkg.v3.scripts.patch, 1.4 KB (added by ppurka, 7 years ago)

Updated the v2 of the file so that it applies to sage-4.8

  • sage-spkg

    # HG changeset patch
    # User Leif Leonhardy <not.really@online.de>
    # Date 1318527817 -7200
    # Node ID bc9c7e540ffc46b1f3553c1db76eb20a7d6c8fd7
    # Parent  25156697de4439f5646b1362453d78169fe9f174
    #10192: sage-spkg: Remove current working directory ('.') from PYTHONPATH before installing an spkg (cf. also #10176).
    
    diff --git a/sage-spkg b/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:"