Changes between Version 26 and Version 27 of SeattleOnAndroid

Changes between Version 26 and Version 27 of SeattleOnAndroid

Please note that these Trac pages are no longer being updated. Wiki contents/documentation have moved to GitHub.

Changes between Version 26 and Version 27 of SeattleOnAndroid

Please note that these Trac pages are no longer being updated. Wiki contents/documentation have moved to GitHub.

Changes between Version 26 and Version 27 of SeattleOnAndroid

Show
Ignore:
Timestamp:
11/05/12 05:50:49 (7 years ago)
Author:
albert
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SeattleOnAndroid

    v26 v27  
    1212---- 
    1313 
    14 = Overview = 
     14== Overview == 
    1515Here is a general outline of steps to be performed. You will get access to Python, Repy (Seattle's runtime), and the Seattle Node Manager, respectively. 
    1616 1. Set up [http://code.google.com/p/android-scripting/wiki/InstallingInterpreters Python for Android (Py4A)]. 
     
    1818 1. Install Seattle on the command line. This won't give you autostart capabilities, though. 
    1919 
    20 = Setting up Python = 
     20== Setting up Python == 
    2121 
    2222 1. On the home screen, press ''Menu''. Go to ''Settings > Applications'' and make sure ''Unknown Sources'' is checked. This is needed for installing non-Market APKs right after downloading them. 
     
    2424 1. Undo Step 1 for obvious security reasons. 
    2525 
     26=== Python from shell === 
    2627 
    27  
    28 = Setting up Repy = 
    29  
    30 Repy is the restricted version of Python Seattle supports. For running Repy programs locally, Py4A is not the optimal choice, but shell access to the Python interpreter is tricky to add because the shell knows nothing about Python's paths yet. Depending on which shell you have, there are different routes to take from here. 
     28Shell access to the Python interpreter is tricky to add because the shell knows nothing about Python's paths yet. Depending on which shell you have, there are different routes to take from here. Be sure to adapt the actual paths to your device/installation. 
    3129 
    3230For {{{sh}}} (which is the default shell also greeting you via [http://developer.android.com/guide/developing/tools/adb.html adb]'s {{{shell}}} command), I don't know yet where it takes its run commands (.shrc) from. If you have [https://github.com/jackpal/Android-Terminal-Emulator/wiki Jackpal's AndroidTerm2] installed, you could write an rc script and configure !AndroidTerm to run it on startup: Press ''Menu'', go to ''Settings > Start command'' and enter /path/to/your/script. 
    3331 
    34 For {{{bash}}}, add the following lines to {{{/system/etc/bash/bashrc}}} (Make sure /system/etc is mounted writable by issuing {{{mount -o rw,remount /system}}} as the superuser) : 
     32For {{{bash}}}, mount {{{/system/etc}}} writable by issuing {{{mount -o rw,remount /system}}} as the superuser. Add the following lines to {{{/system/etc/bash/bashrc}}} : 
    3533{{{ 
    3634export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/data/com.googlecode.pythonforandroid/files/python/lib 
     
    4139}}} 
    4240 
    43 (The last line is needed to make the {{{Popen}}} calls to the Python interpreter work). These lines are inspired by [http://code.google.com/p/python-for-android/source/browse/python-build/standalone_python.sh this file in the Py4A repository], but not all of their path names work on our phone. I'm not blaming the original authors -- pathnames are a botch in Android, everything shows up in multiple places (/etc == /system/etc and so on), and all of a sudden you find yourself on a device not supporting links (sdcard, its filesystem is VFAT) or mounted read-only but listed as temp directory. 
     41(The last line is needed to make the {{{Popen}}} calls to the Python interpreter work). These lines are inspired by [http://code.google.com/p/python-for-android/source/browse/python-build/standalone_python.sh this file in the Py4A repository]. 
    4442 
    45 On my installation with {{{bash}}}, the Python interpreter can now be run from any path in the filesystem, and can {{{import socket}}} etc. 
    46  
    47 You can now proceed to downloading Seattle. 
     43#!comment out all of their path names work on our phone. I'm not blaming the original authors -- pathnames are a botch in Android, everything shows up in multiple places (/etc == /system/etc and so on), and all of a sudden you find yourself on a device not supporting links (sdcard, its filesystem is VFAT) or mounted read-only but listed as temp directory. 
    4844 
    4945 
    50 = Seattle = 
    51 == General Installation Pitfalls == 
    52 Download the Seattle Linux installer (it could be a customized installer as well). If you downloaded Seattle to the standard download folder on the SD card, it won't run even if correctly patched (stating "Bad interpreter: Permission denied") unless you remount the SD card with the {{{exec}}} option (as hinted [http://www.google.com/url?sa=t&source=web&cd=3&ved=0CDcQFjAC&url=http%3A%2F%2Fubuntuforums.org%2Fshowthread.php%3Ft%3D27138&ei=uQCyTcTYBsWZOt2-1PgI&usg=AFQjCNExH-jP9IMTAfbYdNgrWKZoXF_9iA here]). I rather moved the Seattle directory to {{{/data/data/edu.washington.cs.seattle/}}}, where the patched scripts can finally be started. 
    5346 
    54 == Running Repy Scripts Locally == 
    55 Put a restrictions file (e.g. the one from the [http://seattlegeni.cs.washington.edu/dist/demokit.zip Seattle demokit]) into your {{{seattle_repy}}} directory. Patch {{{nix_common_api.py}}} because {{{ctypes.util.find_library}}} fails on Android. ([http://docs.python.org/library/ctypes#finding-shared-libraries The Python docs] say find_library uses ldconfig, gcc, and objdump to locate the library, neither of which are available on our Android.) Here's the relevant patch (you'll probably need to adapt the {{{path/to/libc}}} on your device): 
    56 {{{ 
    57 localhost seattle_repy # diff ../../seattle/seattle_repy/nix_common_api.py nix_common_api.py 
    58 --- ../../seattle/seattle_repy/nix_common_api.py 
    59 +++ nix_common_api.py 
    60 @@ -17,7 +17,7 @@ 
    61  import textops 
    62   
    63  # Get the standard library 
    64 -libc = ctypes.CDLL(ctypes.util.find_library("c")) 
    65 +libc = ctypes.CDLL("/system/lib/libc.so") 
    66   
    67  # Functions 
    68  _strerror = libc.strerror 
    69 }}} 
     47== Setting up Repy == 
    7048 
    71 Congrats, now you can run {{{python repy.py restrictions.that_you_have your_script.repy}}}! 
     49Repy is the restricted version of Python Seattle supports. To install the Repy runtime environment, you need to prepare the required files beforehand: 
     50 
     51 1. Check out {{{trunk}}} (>=r5656) from Seattle's SVN 
     52 1. Create a directory for the required files, let's call it {{{/target}}}. 
     53 1. Inside {{{trunk}}}, run {{{python preparetest.py /target}}}. 
     54 1. Download a restrictions file [attachment:restrictions.test:wiki:RepyTutorial such as this one] to {{{/target}}}. 
     55 
     56Finally, upload the contents of {{{/path/to/files}}} to your Android device, e.g. using {{{adb push /target /seattle/on/android/directory}}}. Congrats, now you can run {{{python repy.py restrictions.that_you_have your_script.repy}}}! 
     57 
     58 
     59 
     60== Setting up Seattle == 
     61 
    7262 
    7363== Donating resources ==