# 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
|
|
340 | 340 | |
341 | 341 | chmod +x spkg-install |
342 | 342 | |
| 343 | # Remove '.' from PYTHONPATH, which may also come from SAGE_PATH, to avoid |
| 344 | # trouble with setuptools / easy_install (cf. #10192, #10176): |
| 345 | if [ -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 |
| 364 | fi |
| 365 | |
343 | 366 | echo "****************************************************" |
344 | 367 | echo "Host system" |
345 | 368 | echo "uname -a:" |