Created
March 13, 2017 15:30
-
-
Save mcotton/3173d2a31fd026bdb6751bc653ef26a2 to your computer and use it in GitHub Desktop.
Fix GAE to use ipython with with remote shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Pathes remote_api_shell.py to use IPython instead of raw python interpreter | |
google_path=`readlink $(which remote_api_shell.py)` | |
google_path=$(dirname $google_path) | |
echo "Google Appengin found on: $google_path" | |
ras_path="$google_path/google/appengine/tools/remote_api_shell.py" | |
if [ -f "$ras_path" ]; then | |
echo "Remote api shell script found at $ras_path." | |
sed -i .original 's/code.interact.*$/\ | |
import IPython\ | |
from IPython.config.loader import Config\ | |
cfg = Config()\ | |
IPython.embed(config=cfg, banner2=BANNER)\ | |
/ | |
' "$ras_path" | |
if [ $? = 0 ]; then | |
echo "Patched :)" | |
echo "Original file can be found as remote_api_shell.py.original" | |
else | |
echo "Error while patching." | |
exit 255 | |
fi | |
else | |
echo "Could not find remote_api_shell.py script. Sorry." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment