Skip to content

Commit 3319b44

Browse files
committed
Removed unused dist arguments
1 parent ded3211 commit 3319b44

File tree

2 files changed

+17
-32
lines changed

2 files changed

+17
-32
lines changed

pythonforandroid/distribution.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ def __repr__(self):
4141
return str(self)
4242

4343
@classmethod
44-
def get_distribution(cls, ctx, name=None, recipes=[], allow_download=True,
44+
def get_distribution(cls, ctx, name=None, recipes=[],
4545
force_build=False,
46-
allow_build=True, extra_dist_dirs=[],
46+
extra_dist_dirs=[],
4747
require_perfect_match=False):
4848
'''Takes information about the distribution, and decides what kind of
4949
distribution it will be.
@@ -59,11 +59,6 @@ def get_distribution(cls, ctx, name=None, recipes=[], allow_download=True,
5959
exists, it will be used.
6060
recipes : list
6161
The recipes that the distribution must contain.
62-
allow_download : bool
63-
Whether binary dists may be downloaded.
64-
allow_build : bool
65-
Whether the distribution may be built from scratch if necessary.
66-
This is always False on e.g. Windows.
6762
force_download: bool
6863
If True, only downloaded dists are considered.
6964
force_build : bool

pythonforandroid/toolchain.py

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ def dist_from_args(ctx, dist_args):
102102
ctx,
103103
name=dist_args.dist_name,
104104
recipes=split_argument_list(dist_args.requirements),
105-
allow_download=False, # TODO: remove
106-
allow_build=dist_args.allow_build,
107105
extra_dist_dirs=split_argument_list(dist_args.extra_dist_dirs),
108106
require_perfect_match=dist_args.require_perfect_match)
109107

@@ -535,16 +533,6 @@ def __init__(self):
535533
help='The bootstrap to build with. Leave unset to choose automatically.',
536534
default=None)
537535

538-
add_boolean_option(
539-
generic_parser, ["allow-download"],
540-
default=False,
541-
description='Whether to allow binary dist download:')
542-
543-
add_boolean_option(
544-
generic_parser, ["allow-build"],
545-
default=True,
546-
description='Whether to allow compilation of a new distribution:')
547-
548536
add_boolean_option(
549537
generic_parser, ["force-build"],
550538
default=False,
@@ -681,21 +669,23 @@ def __init__(self):
681669
parents=[generic_parser])
682670

683671
print('ready to parse', sys.argv[1:])
684-
args = parser.parse_args(sys.argv[1:])
672+
args, unknown = parser.parse_known_args(sys.argv[1:])
673+
args.unknown_args = unknown
685674
print('args are', args)
686675

687676
setup_color(args.color)
688677

689678
# strip version from requirements, and put them in environ
690-
requirements = []
691-
for requirement in split_argument_list(args.requirements):
692-
if "==" in requirement:
693-
requirement, version = requirement.split(u"==", 1)
694-
os.environ["VERSION_{}".format(requirement)] = version
695-
info('Recipe {}: version "{}" requested'.format(
696-
requirement, version))
697-
requirements.append(requirement)
698-
args.requirements = u",".join(requirements)
679+
if hasattr(args, 'requirements'):
680+
requirements = []
681+
for requirement in split_argument_list(args.requirements):
682+
if "==" in requirement:
683+
requirement, version = requirement.split(u"==", 1)
684+
os.environ["VERSION_{}".format(requirement)] = version
685+
info('Recipe {}: version "{}" requested'.format(
686+
requirement, version))
687+
requirements.append(requirement)
688+
args.requirements = u",".join(requirements)
699689

700690
self.ctx = Context()
701691
self.storage_dir = args.storage_dir
@@ -845,7 +835,7 @@ def export_dist(self, args):
845835
and can use the apk command instead.
846836
'''
847837
ctx = self.ctx
848-
dist = dist_from_args(ctx, self.dist_args)
838+
dist = dist_from_args(ctx, args)
849839
if dist.needs_build:
850840
info('You asked to export a dist, but there is no dist '
851841
'with suitable recipes available. For now, you must '
@@ -918,7 +908,7 @@ def apk(self, args):
918908

919909
build = imp.load_source('build', join(dist.dist_dir, 'build.py'))
920910
with current_directory(dist.dist_dir):
921-
build_args = build.parse_args(args)
911+
build_args = build.parse_args(args.unknown_args)
922912
output = shprint(sh.ant, apk_args.build_mode, _tail=20, _critical=True, _env=env)
923913

924914
info_main('# Copying APK to current directory')
@@ -1049,7 +1039,7 @@ def adb(self, args):
10491039
def logcat(self, args):
10501040
'''Runs ``adb logcat`` using the adb binary from the detected SDK
10511041
directory. All extra args are passed as arguments to logcat.'''
1052-
self.adb(['logcat'] + args)
1042+
self.adb(['logcat'] + args.unknown_args)
10531043

10541044
def build_status(self, args):
10551045

0 commit comments

Comments
 (0)