Closed Bug 1154006 Opened 5 years ago Closed 5 years ago

Ability to lazy load argument parsers passed in via @Command decorator

Categories

(Firefox Build System :: Mach Core, enhancement)

enhancement
Not set

Tracking

(firefox40 fixed)

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: ahal, Assigned: ahal)

References

Details

Attachments

(1 file, 1 obsolete file)

There's a 'parser' argument to the @Command decorator which is super helpful if you want to delegate command line handling to the underlying module. Unfortunately it requires an ArgumentParser instance which means it needs to be instantiated at parse time. In other words, the instance will be created every time mach gets invoked, even if running 'help' or a completely unrelated command.

It should also be possible (I'd even argue required) to lazy load the parsers instead.
Assignee: nobody → ahalberstadt
Status: NEW → ASSIGNED
Attached file MozReview Request: bz://1154006/ahal (obsolete) —
/r/7005 - Bug 1154006 - [mach] Ability to lazy load parsers passed in via the @Command decorator, r=gps

Pull down this commit:

hg pull -r 8d9d466395c8ef0bf64e43a17bd1293b92ec52aa https://reviewboard-hg.mozilla.org/gecko/
Attachment #8591851 - Flags: review?(gps)
Comment on attachment 8591851 [details]
MozReview Request: bz://1154006/ahal

/r/7005 - Bug 1154006 - [mach] Ability to lazy load parsers passed in via the @Command decorator, r=gps

Pull down this commit:

hg pull -r d596a8c1c5a947de18c8c6bfe1e7642074871fcb https://reviewboard-hg.mozilla.org/gecko/
The latest version passes the context to handler.parser. I need this so the MochitestArgumentParser can intelligently set --xre-path on B2G (which gets passed in via the context), among other things.

For context, my goal is to make the mochitest harness do all of the smart things that the mach command currently handles.
Blocks: 1155338
Comment on attachment 8591851 [details]
MozReview Request: bz://1154006/ahal

https://reviewboard.mozilla.org/r/7003/#review5973

Nice.
Attachment #8591851 - Flags: review?(gps) → review+
https://hg.mozilla.org/mozilla-central/rev/15b5a4242cf2
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Attachment #8591851 - Attachment is obsolete: true
Attachment #8620033 - Flags: review+
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.