Advertisement
gauravssnl

python2.sh

May 16th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #! /system/bin/sh
  2. st=`for i in /mnt/storage /mnt/sdcard /sdcard; do [ -d $i ] && echo $i && break; done`
  3. if [ x$api != x ]; then :
  4. elif ! type \cut > /dev/null; then api=14; else
  5. api=`grep build.version.sdk /system/build.prop | cut -d = -f 2`
  6. fi
  7.  
  8.  
  9. PW=`pwd`
  10. export EXTERNAL_STORAGE=$st
  11. export LANG=en
  12. bin=/data/data/com.googlecode.pythonforandroid/files/python
  13. ext=$st/com.googlecode.pythonforandroid/extras/python
  14. PYTHONPATH=$ext
  15. PYTHONPATH=${PYTHONPATH}:$bin/lib/python2.7/lib-dynload
  16. export PYTHONPATH
  17. export TEMP=$ext/tmp
  18. export PYTHON_EGG_CACHE=$TEMP
  19. export PYTHONHOME=/data/data/com.googlecode.pythonforandroid/files/python
  20. export LD_LIBRARY_PATH=$bin/lib
  21. cd $PW
  22. if [ $api -lt 14 ]; then
  23. run=/data/data/com.googlecode.android_scripting/files/run_pie
  24. if ! [ -x $run ]; then
  25. echo "need root permission to launch run_pie/python"
  26. ls -l "$run"
  27. # su -c "chmod 755 $run" # this was failed...
  28. su -c "$run $bin/bin/python $*"
  29. else
  30. $run $bin/bin/python $*
  31. fi
  32. else
  33. $bin/bin/python $*
  34. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement