Closed Bug 1581684 Opened 10 months ago Closed 3 months ago

Make `mach mach completion <command>` use the right Python

Categories

(Firefox Build System :: Mach Core, defect, P1)

defect

Tracking

(firefox-esr68 unaffected, firefox75 unaffected, firefox76 wontfix, firefox77 fixed)

RESOLVED FIXED
mozilla77
Tracking Status
firefox-esr68 --- unaffected
firefox75 --- unaffected
firefox76 --- wontfix
firefox77 --- fixed

People

(Reporter: kmag, Assigned: ahal)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(3 files, 1 obsolete file)

+++ This bug was initially created as a clone of Bug #1577501 +++

This is super annoying as it causes tab-completion to munge my existing input.

Blocks: mach-busted
Duplicate of this bug: 1598732
Pushed by maglione.k@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/311a7c41e9da
Make sure ./mach mach-completion <command> uses the correct Python. r=ahal

This solves an edge case where tab completing a Python 2 command with global
arguments was using the wrong Python version.

Assignee: nobody → ahal
Keywords: leave-open

Looks like this regressed again in the last few days. Rough regression range: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=1d96f4423d16&tochange=6c6c67870c37

Andrew, can you update the second patch and land it?

Flags: needinfo?(ahal)

Sure I'll try and get it landed soon, though looks like Matt isn't hitting the edge case, this is broken for everything. Running python2 mach mach-completion task results in this traceback:

AttributeError: 'functools.partial' object has no attribute '__name__'

  File "/home/ahal/dev/mozilla-central/python/mach/mach/commands/commandinfo.py", line 62, in completion
    all_commands = sorted(self.command_keys)
  File "/home/ahal/dev/mozilla-central/python/mach/mach/commands/commandinfo.py", line 26, in <genexpr>
    if not v.conditions or v.conditions[0].__name__ != 'REMOVED')

So looks like a regression from https://phabricator.services.mozilla.com/D67342.

Tarek, did you have a WIP somewhere to stop using functools in the conditions function? Though we probably shouldn't be relying on conditions[0].__name__ in commandinfo.py anyway.

Flags: needinfo?(ahal) → needinfo?(tarek)
Regressed by: 1623321
Status: NEW → ASSIGNED

Yeah nvm, I'll just fix this here. Have a working patch, will attempt to add a test as well.

Flags: needinfo?(tarek)

Ah ok, thanks, I did add Bug 1626942 if you want to close it after you're done

Not all callables have a name attribute.

(In reply to Mike Hommey [:glandium] from comment #8)

Andrew, can you update the second patch and land it?

Unfortunately I still don't see a good way of implementing your comment, see my reply for more details. It's very possible I'm missing something obvious, but it's been taking up more time than I have to spend.

This solves an edge case where tab completing a Python 2 command with global
arguments was using the wrong Python version.

Attachment #9139368 - Attachment is obsolete: true
Attachment #9114692 - Attachment description: Bug 1581684 - [mach] Fix 'mach mach-completion mach -v <command>' (for Python 2 commands), r?glandium → Bug 1581684 - Fix `mach mach-completion mach -flag <command>` for python 2 commands.
Pushed by ahalberstadt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/84c16bc42776
[mach] Fix regression to mach command completion, r=glandium
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/ef38e7c833c7
Fix `mach mach-completion mach -flag <command>` for python 2 commands. r=ahal

Should this bug be resolved now or was this still just a temporary solution?

Thanks, everything should be fixed now.

Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Keywords: leave-open
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.