Closed Bug 879406 Opened 11 years ago Closed 11 years ago

'mach help debug' and 'mach help run' fail with ValueError: invalid option string u'+remote': must start with a character '-'

Categories

(Firefox Build System :: Mach Core, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla24

People

(Reporter: mccr8, Assigned: gps)

References

Details

Attachments

(1 file)

Error running mach:

    ['help', 'debug']

The error occurred in mach itself. This is likely a bug in mach itself or a
fundamental problem with a loaded module.

Please consider filing a bug against mach by going to the URL:

    https://bugzilla.mozilla.org/enter_bug.cgi?product=Core&component=mach


If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

ValueError: invalid option string u'+remote': must start with a character '-'

  File "/Users/amccreight/mz/cent2/python/mach/mach/main.py", line 259, in run
    return self._run(argv)
  File "/Users/amccreight/mz/cent2/python/mach/mach/main.py", line 297, in _run
    args = parser.parse_args(argv)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1688, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1720, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1929, in _parse_known_args
    stop_index = consume_positionals(start_index)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1885, in consume_positionals
    take_action(action, args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1794, in take_action
    action(self, namespace, argument_values, option_string)
  File "/Users/amccreight/mz/cent2/python/mach/mach/dispatcher.py", line 86, in __call__
    self._handle_subcommand_help(parser, args[0])
  File "/Users/amccreight/mz/cent2/python/mach/mach/dispatcher.py", line 166, in _handle_subcommand_help
    group.add_argument(*arg[0], **arg[1])
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1267, in add_argument
    kwargs = self._get_optional_kwargs(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1397, in _get_optional_kwargs
    raise ValueError(msg % tup)
Summary: 'mach help debug' fails with a python exception → 'mach help debug' and 'mach help run' fail with ValueError: invalid option string u'+remote': must start with a character '-'
Assignee: nobody → gps
Comment on attachment 760946 [details] [diff] [review]
Unbust |mach help| when arguments are not prefixed with '-'

Review of attachment 760946 [details] [diff] [review]:
-----------------------------------------------------------------

::: python/mach/mach/dispatcher.py
@@ +184,5 @@
> +
> +        if handler.allow_all_arguments:
> +            parser_args['prefix_chars'] = '+'
> +
> +        c_parser = argparse.ArgumentParser(**parser_args)

Is it worth wrapping these lines up in a helper function instead of repeating them?
Attachment #760946 - Flags: review?(ted) → review+
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #3)
> Is it worth wrapping these lines up in a helper function instead of
> repeating them?

Perhaps. But I'm lazy ATM :)
Status: NEW → ASSIGNED
OS: Mac OS X → All
Hardware: x86 → All
https://hg.mozilla.org/mozilla-central/rev/7d50de16dff8
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: