Skip to content

Instantly share code, notes, and snippets.

Last active January 4, 2016 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZoomQuiet/8645207 to your computer and use it in GitHub Desktop.
Save ZoomQuiet/8645207 to your computer and use it in GitHub Desktop.
Fabric for QPython auto upload/running script/collect log etc... from local through SSH
from fabric.api import local, env, run
#import os = "/system/bin/sh -c"
# Local path configuration (can be absolute or relative to fabfile)
# Remote server configuration
PY = '/data/data/com.hipipal.qpyplus/files/bin/python'
PYQ = 'root@'
env.hosts= [PYQ]
env.user = "root"
PYQ_ROOT = '/storage/sdcard0/com.hipipal.qpyplus/projects'
PROJ_NAME = 'chaos'
CRT_PROJ = "%(PYQ_ROOT)s/%(PROJ_NAME)s"% locals()
SCP_UP = "scp *.py %(PYQ)s:%(CRT_PROJ)s/ "% locals()
# Actions define.
#def pushproj(ports='22', name='chaos'):
def pushproj():
'''scp all .py into Android QPython projects dir
print SCP_UP
def qpy_run_it(script=""):
run('ls -la ./')
#run('export PYTHONHOME=/data/data/com.hipipal.qpyplus/files')
print '%s %s/%s'% (PY, CRT_PROJ, script)
#run('%s %s/%s'% (PY, CRT_PROJ, script))
run('source %s/qpy_profile && %s %s/%s'% (PYQ_ROOT
, PY
, script
#run('%s %s/%s'% (PY, CRT_PROJ, script))
'''main develop loop usage :
$ fab
so fab will auto:
- scp all local .py up into mobile QPython projects fold
- and source right sys. env
- and call the ''
- so wiil see the script running in mobile desktop ;-)
def qpy(script=""):
'''main develop tools, auto upload and running in Android
def uname():
'''print Android sys. info.
run('uname -a')
def env():
'''print Android sys. env
print 'source %s/qpy_profile'% PYQ_ROOT
#run('source %s/qpy_profile && env'% PYQ_ROOT)
def genenv(script=""):
'''gen qpy need env into: /storage/sdcard0/com.hipipal.qpyplus/projects/qpy_profile
run('ls -la %s'% CRT_PROJ)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment