Bug 1580492 - Run mach 'core' commands with Python 3. r=ahal

Differential Revision: https://phabricator.services.mozilla.com/D45694

--HG--
extra : moz-landing-system : lando
This commit is contained in:
championshuttler 2019-09-12 20:26:45 +00:00
Родитель 28c79c116e
Коммит a19f899a6f
2 изменённых файлов: 4 добавлений и 8 удалений

4
mach
Просмотреть файл

@ -56,9 +56,6 @@ py2commands="
jstestbrowser jstestbrowser
jstests jstests
lint lint
mach-commands
mach-completion
mach-debug-commands
marionette-test marionette-test
mochitest mochitest
mozbuild-reference mozbuild-reference
@ -86,7 +83,6 @@ py2commands="
run-android run-android
run-desktop run-desktop
rusttests rusttests
settings
show-log show-log
static-analysis static-analysis
talos-test talos-test

Просмотреть файл

@ -385,7 +385,7 @@ class CommandAction(argparse.Action):
' subcommand [subcommand arguments]' ' subcommand [subcommand arguments]'
group = parser.add_argument_group('Sub Commands') group = parser.add_argument_group('Sub Commands')
for subcommand, subhandler in sorted(handler.subcommand_handlers.iteritems()): for subcommand, subhandler in sorted(handler.subcommand_handlers.items()):
group.add_argument(subcommand, help=subhandler.description, group.add_argument(subcommand, help=subhandler.description,
action='store_true') action='store_true')
@ -397,7 +397,7 @@ class CommandAction(argparse.Action):
parser.print_help() parser.print_help()
def _handle_subcommand_help(self, parser, handler, args): def _handle_subcommand_help(self, parser, handler, args):
subcommand = set(args).intersection(handler.subcommand_handlers.keys()) subcommand = set(args).intersection(list(handler.subcommand_handlers.keys()))
if not subcommand: if not subcommand:
return self._handle_subcommand_main_help(parser, handler) return self._handle_subcommand_main_help(parser, handler)
@ -452,13 +452,13 @@ def format_docstring(docstring):
if not docstring: if not docstring:
return '' return ''
lines = docstring.expandtabs().splitlines() lines = docstring.expandtabs().splitlines()
indent = sys.maxint indent = sys.maxsize
for line in lines[1:]: for line in lines[1:]:
stripped = line.lstrip() stripped = line.lstrip()
if stripped: if stripped:
indent = min(indent, len(line) - len(stripped)) indent = min(indent, len(line) - len(stripped))
trimmed = [lines[0].strip()] trimmed = [lines[0].strip()]
if indent < sys.maxint: if indent < sys.maxsize:
for line in lines[1:]: for line in lines[1:]:
trimmed.append(line[indent:].rstrip()) trimmed.append(line[indent:].rstrip())
while trimmed and not trimmed[-1]: while trimmed and not trimmed[-1]: