Closed
Bug 1179488
Opened 11 years ago
Closed 11 years ago
Accept any arguments passed to deprecated commands
Categories
(Firefox Build System :: Mach Core, enhancement)
Firefox Build System
Mach Core
Tracking
(firefox42 fixed)
RESOLVED
FIXED
mozilla42
| Tracking | Status | |
|---|---|---|
| firefox42 | --- | fixed |
People
(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)
Details
Attachments
(1 file)
|
1.60 KB,
patch
|
gps
:
review+
|
Details | Diff | Splinter Review |
Without this, we throw UnrecognizedArgumentError when running commands
such as `./mach mochitest-plain test`, which causes an error message
such as the below to be emitted:
It looks like you passed an unrecognized argument into mach.
The mochitest-plain command does not accept the arguments: test
This patch will fix the above command to instead print the corresponding
deprecation message.
| Assignee | ||
Comment 1•11 years ago
|
||
Attachment #8628491 -
Flags: review?(gps)
Comment 2•11 years ago
|
||
Comment on attachment 8628491 [details] [diff] [review]
Accept any arguments passed to deprecated commands
Review of attachment 8628491 [details] [diff] [review]:
-----------------------------------------------------------------
See comment for preferred resolution.
::: python/mach/mach/dispatcher.py
@@ +229,5 @@
> if extra:
> setattr(command_namespace, name, extra)
> else:
> setattr(command_namespace, name, options.get('default', []))
> + elif extra and not handler.cls.__name__ == 'DeprecatedCommands':
The DeprecatedCommands class comes from testing/mochitest/mach_commands.py. This is touching code in mach core. It is therefore a layering violation to check for the presence of a class defined outside the mach core.
The proper way to do this is to implement a "deprecated commands" mach feature or change the arguments of the deprecated commands to accept all arguments. e.g.:
@CommandArgument('args', nargs=argparse.REMAINDER)
Attachment #8628491 -
Flags: review?(gps)
| Assignee | ||
Comment 3•11 years ago
|
||
(In reply to Gregory Szorc [:gps] from comment #2)
> ::: python/mach/mach/dispatcher.py
> @@ +229,5 @@
> > if extra:
> > setattr(command_namespace, name, extra)
> > else:
> > setattr(command_namespace, name, options.get('default', []))
> > + elif extra and not handler.cls.__name__ == 'DeprecatedCommands':
>
> The DeprecatedCommands class comes from testing/mochitest/mach_commands.py.
> This is touching code in mach core. It is therefore a layering violation to
> check for the presence of a class defined outside the mach core.
dispatcher.py already depends on this *exact* same pattern <http://mxr.mozilla.org/mozilla-central/source/python/mach/mach/dispatcher.py#114>.
> The proper way to do this is to implement a "deprecated commands" mach
> feature or change the arguments of the deprecated commands to accept all
> arguments. e.g.:
>
> @CommandArgument('args', nargs=argparse.REMAINDER)
Do you mean doing that for all DeprecatedCommands forever is better than handling this in a central place?
Flags: needinfo?(gps)
Comment 4•11 years ago
|
||
Comment on attachment 8628491 [details] [diff] [review]
Accept any arguments passed to deprecated commands
Review of attachment 8628491 [details] [diff] [review]:
-----------------------------------------------------------------
OK. Since we already have the cls.__name__ == 'DeprecatedCommands' hack in dispatcher.py, this is acceptable.
::: python/mach/mach/dispatcher.py
@@ +229,5 @@
> if extra:
> setattr(command_namespace, name, extra)
> else:
> setattr(command_namespace, name, options.get('default', []))
> + elif extra and not handler.cls.__name__ == 'DeprecatedCommands':
and handler.cls.__name__ != 'DeprecatedCommands':
Attachment #8628491 -
Flags: review+
Updated•11 years ago
|
Flags: needinfo?(gps)
| Assignee | ||
Comment 5•11 years ago
|
||
Thanks!
BTW, if there is a less hacky way to detect the type of this object than looking at its class name, please let me know how and I'll fix it.
Assignee: nobody → ehsan
Status: NEW → RESOLVED
Closed: 11 years ago
status-firefox42:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
Updated•8 years ago
|
Product: Core → Firefox Build System
You need to log in
before you can comment on or make changes to this bug.
Description
•