8000 Disabled argparse arg abbreviation · kivy/python-for-android@6d8c554 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6d8c554

Browse files
committed
Disabled argparse arg abbreviation
1 parent b96e028 commit 6d8c554

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pythonforandroid/toolchain.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def check_python_dependencies():
2323
ok = True
2424

2525
modules = [('colorama', '0.3.3'), 'appdirs', ('sh', '1.10'), 'jinja2',
26-
'argparse', 'six']
26+
'six']
2727

2828
for module in modules:
2929
if isinstance(module, tuple):
@@ -196,11 +196,21 @@ def split_argument_list(l):
196196
return []
197197
return re.split(r'[ ,]+', l)
198198

199+
class NoAbbrevParser(argparse.ArgumentParser):
200+
'''We want to disable argument abbreviation so as not to interfere
201+
with passing through arguments to build.py, but in python2 argparse
202+
doesn't have this option.
203+
204+
This subclass alternative is follows the suggestion at
205+
https://bugs.python.org/issue14910.
206+
'''
207+
def _get_option_tuples(self, option_string):
208+
return []
199209

200210
class ToolchainCL(object):
201211

202212
def __init__(self):
203-
parser = argparse.ArgumentParser(
213+
parser = NoAbbrevParser(
204214
description=('A packaging tool for turning Python scripts and apps '
205215
'into Android APKs'))
206216

0 commit comments

Comments
 (0)
0