8000 Merge pull request #554 from kived/parse-dist-args · latin1593/python-for-android@3688bb9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3688bb9

Browse files
committed
Merge pull request kivy#554 from kived/parse-dist-args
always parse dist args
2 parents c6ca066 + 2b5a86e commit 3688bb9

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

pythonforandroid/toolchain.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,11 @@ def wrapper_func(self, args):
9898
user_android_api=self.android_api,
9999
user_ndk_ver=self.ndk_version)
100100
dist = self._dist
101+
dist_args, args = parse_dist_args(args)
101102
if dist.needs_build:
102103
info_notify('No dist exists that meets your requirements, '
103104
'so one will be built.')
104-
args = build_dist_from_args(ctx, dist, args)
105+
build_dist_from_args(ctx, dist, dist_args)
105106
func(self, args)
106107
return wrapper_func
107108

@@ -120,20 +121,9 @@ def dist_from_args(ctx, dist_args):
120121
require_perfect_match=dist_args.require_perfect_match)
121122

122123

123-
def build_dist_from_args(ctx, dist, args_list):
124+
def build_dist_from_args(ctx, dist, args):
124125
'''Parses out any bootstrap related arguments, and uses them to build
125126
a dist.'''
126-
parser = argparse.ArgumentParser(
127-
description='Create a newAndroid project')
128-
parser.add_argument(
129-
'--bootstrap',
130-
help=('The name of the bootstrap type, \'pygame\' '
131-
'or \'sdl2\', or leave empty to let a '
132-
'bootstrap be chosen automatically from your '
133-
'requirements.'),
134-
default=None)
135-
args, unknown = parser.parse_known_args(args_list)
136-
137127
bs = Bootstrap.get_bootstrap(args.bootstrap, ctx)
138128
build_order, python_modules, bs \
139129
= get_recipe_order_and_bootstrap(ctx, dist.recipes, bs)
@@ -156,8 +146,19 @@ def build_dist_from_args(ctx, dist, args_list):
156146
info('Dist can be found at (for now) {}'
157147
.format(join(ctx.dist_dir, ctx.dist_name)))
158148

159-
return unknown
160149

150+
def parse_dist_args(args_list):
151+
parser = argparse.ArgumentParser(
152+
description='Create a newAndroid project')
153+
parser.add_argument(
154+
'--bootstrap',
155+
help=('The name of the bootstrap type, \'pygame\' '
156+
'or \'sdl2\', or leave empty to let a '
157+
'bootstrap be chosen automatically from your '
158+
'requirements.'),
159+
default=None)
160+
args, unknown = parser.parse_known_args(args_list)
161+
return args, unknown
161162

162163

163164
def split_argument_list(l):

0 commit comments

Comments
 (0)
0