Skip to content

Commit e6ee1c5

Browse files
committed
Added sdk_tools argument
1 parent 70230ff commit e6ee1c5

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

pythonforandroid/toolchain.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2719,6 +2719,29 @@ def delete_dist(self, args):
27192719
if dist.needs_build:
27202720
info('No dist exists that matches your specifications, exiting without deleting.')
27212721
shutil.rmtree(dist.dist_dir)
2722+
2723+
def sdk_tools(self, args):
2724+
'''Runs the android binary from the detected SDK directory, passing
2725+
all arguments straight to it. This binary is used to install
2726+
e.g. platform-tools for different API level targets. This is
2727+
intended as a convenience function if android is not in your
2728+
$PATH.
2729+
'''
2730+
parser = argparse.ArgumentParser(
2731+
description='Run a binary from the /path/to/sdk/tools directory')
2732+
parser.add_argument('tool', help=('The tool binary name to run'))
2733+
args, unknown = parser.parse_known_args(args)
2734+
2735+
ctx = self.ctx
2736+
ctx.prepare_build_environment(user_sdk_dir=self.sdk_dir,
2737+
user_ndk_dir=self.ndk_dir,
2738+
user_android_api=self.android_api,
2739+
user_ndk_ver=self.ndk_version)
2740+
android = sh.Command(join(ctx.sdk_dir, 'tools', args.tool))
2741+
output = android(*unknown, _iter=True, _out_bufsize=1, _err_to_out=True)
2742+
for line in output:
2743+
sys.stdout.write(line)
2744+
sys.stdout.flush()
27222745

27232746
def adb(self, args):
27242747
'''Runs the adb binary from the detected SDK directory, passing all

0 commit comments

Comments
 (0)