|
40 | 40 | import sh
|
41 | 41 | from colorama import Style, Fore
|
42 | 42 |
|
43 |
| -curdir = dirname(__file__) |
44 |
| -sys.path.insert(0, join(curdir, "tools", "external")) |
| 43 | +user_dir = dirname(realpath(os.path.curdir)) |
| 44 | +toolchain_dir = dirname(__file__) |
| 45 | +sys.path.insert(0, join(toolchain_dir, "tools", "external")) |
45 | 46 |
|
46 | 47 |
|
47 | 48 | DEFAULT_ANDROID_API = 15
|
@@ -2401,6 +2402,7 @@ class ToolchainCL(object):
|
2401 | 2402 | def __init__(self):
|
2402 | 2403 | self._ctx = None
|
2403 | 2404 |
|
| 2405 | + |
2404 | 2406 | parser = argparse.ArgumentParser(
|
2405 | 2407 | description="Tool for managing the Android / Python toolchain",
|
2406 | 2408 | usage="""toolchain <command> [<args>]
|
@@ -2716,21 +2718,22 @@ def apk(self, args):
|
2716 | 2718 |
|
2717 | 2719 | ctx = self.ctx
|
2718 | 2720 | dist = self._dist
|
2719 |
| - # dist = dist_from_args(ctx, self.dist_args) |
2720 |
| - # if dist.needs_build: |
2721 |
| - # info('No dist exists that meets your requirements, so one will ' |
2722 |
| - # 'be built.') |
2723 |
| - # args = build_dist_from_args(ctx, dist, args) |
| 2721 | + |
| 2722 | + # Manually fixing these arguments at the string stage is |
| 2723 | + # unsatisfactory and should probably be changed somehow, but |
| 2724 | + # we can't leave it until later as the build.py scripts assume |
| 2725 | + # they are in the current directory. |
| 2726 | + for i, arg in enumerate(args[:-1]): |
| 2727 | + if arg in ('--dir', '--private'): |
| 2728 | + args[i+1] = realpath(expanduser(args[i+1])) |
2724 | 2729 |
|
2725 | 2730 | build = imp.load_source('build', join(dist.dist_dir, 'build.py'))
|
2726 | 2731 | with current_directory(dist.dist_dir):
|
2727 | 2732 | build.parse_args(args)
|
2728 |
| - |
2729 | 2733 | shprint(sh.ant, 'debug')
|
2730 | 2734 |
|
2731 | 2735 | # AND: This is very crude, needs improving. Also only works
|
2732 | 2736 | # for debug for now.
|
2733 |
| - |
2734 | 2737 | info_main('# Copying APK to current directory')
|
2735 | 2738 | apks = glob.glob(join(dist.dist_dir, 'bin', '*-*-debug.apk'))
|
2736 | 2739 | if len(apks) == 0:
|
|
0 commit comments