Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Improve --patchbot command
Browse files Browse the repository at this point in the history
  • Loading branch information
jdemeyer committed Mar 1, 2017
1 parent 537849f commit c9c4101
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/bin/sage
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,26 @@ fi
# an unclobbered environment before testing unsafe tickets.
if [ "$1" = '-patchbot' -o "$1" = "--patchbot" ]; then
shift
# We ask the Python from Sage where the patchbot is installed.
# We set PYTHONPATH to that directory such that the system Python
# should also find the sage_patchbot package.
cmd='import sage_patchbot as p; import os; print(os.path.dirname(p.__path__[0]))'
export PYTHONPATH=`"$SAGE_ROOT/sage" --python -c "$cmd"`
if [ -z "$PYTHONPATH" ]; then
# Something went wrong, assume that the patchbot is not installed
echo >&2 "Error: cannot find installation path for sage_patchbot"
echo >&2 "See https://wiki.sagemath.org/buildbot for instructions"
exit 1
fi

# Try "python2.7", then "python2", then "python"
shopt -s execfail # Do not exit if "exec" fails
exec python2.7 -m sage_patchbot.patchbot "$@"
exec python2 -m sage_patchbot.patchbot "$@"
exec python -m sage_patchbot.patchbot "$@"
echo >&2 "Error: cannot find a suitable Python program."
echo >&2 "The SageMath patchbot requires a system Python installation."
exit 127
fi

# Check for '--upgrade' before sourcing sage-env: the top-level "make"
Expand Down

0 comments on commit c9c4101

Please sign in to comment.