improve adb command, add p4a command

This commit is contained in:
Ryan Pessa 2016-04-22 01:18:40 -05:00
parent 3ec383479b
commit 49d56f0961
3 changed files with 29 additions and 6 deletions

View file

@ -52,8 +52,13 @@ class Target(object):
result = []
last_command = []
for arg in args:
if not arg.startswith('--'):
while args:
arg = args.pop(0)
if arg == '--':
if last_command:
last_command += args
break
elif not arg.startswith('--'):
if last_command:
result.append(last_command)
last_command = []

View file

@ -840,10 +840,15 @@ class TargetAndroid(Target):
def cmd_adb(self, *args):
self.check_requirements()
print('To set up ADB in this shell session, execute:')
print(' alias adb=$(buildozer {} adb 2>&1 >/dev/null)'
.format(self.targetname))
sys.stderr.write(self.adb_cmd + '\n')
self.install_platform()
args = args[0]
if args and args[0] == '--alias':
print('To set up ADB in this shell session, execute:')
print(' alias adb=$(buildozer {} adb --alias 2>&1 >/dev/null)'
.format(self.targetname))
sys.stderr.write(self.adb_cmd + '\n')
else:
self.buildozer.cmd(' '.join([self.adb_cmd] + args))
def cmd_deploy(self, *args):
super(TargetAndroid, self).cmd_deploy(*args)

View file

@ -2,6 +2,7 @@
'''
Android target, based on python-for-android project (new toolchain)
'''
import sys
from buildozer.targets.android import TargetAndroid
from os.path import join, expanduser, realpath
@ -104,6 +105,18 @@ class TargetAndroidNew(TargetAndroid):
self.buildozer.config.set('app', 'android.entrypoint', 'org.kivy.android.PythonActivity')
return super(TargetAndroidNew, self).cmd_run(*args)
def cmd_p4a(self, *args):
self.check_requirements()
self.install_platform()
args = args[0]
if args and args[0] == '--alias':
print('To set up p4a in this shell session, execute:')
print(' alias p4a=$(buildozer {} p4a --alias 2>&1 >/dev/null)'
.format(self.targetname))
sys.stderr.write('PYTHONPATH={} {}\n'.format(self.pa_dir, self._p4a_cmd))
else:
self._p4a(' '.join(*args))
def get_target(buildozer):
buildozer.targetname = "android"