Closed Bug 1598732 Opened 5 years ago Closed 4 years ago

Mach's bash completion gives bogus results after `mach mochitest`

Categories

(Firefox Build System :: Mach Core, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1581684

People

(Reporter: botond, Unassigned)

Details

(Keywords: in-triage)

STR

  1. Install mach's bash completion by adding a line similar to source <srcdir>/python/mach/bash-completion.sh to .bashrc.
  2. In your srcdir, type ./mach mochitest editor/ and invoke completion by pressing "Tab".

Expected results

The shell prints a list of files and directories in the editor directory.

Actual results

The shell completes a ], as in ./mach mochitest editor/].

It looks like this broke from bug 1580492, since ./mach mach-completion now runs in python3. However, ./mach mach-completion mochitest imports testing/mochitest/runtests.py, which is not py3 compatible, resulting in:

ModuleNotFoundError: No module named 'urllib2'

  File "/home/mshal/mozilla-central-git/python/mach/mach/commands/commandinfo.py", line 101, in completion
    if handler.parser:
  File "/home/mshal/mozilla-central-git/python/mach/mach/decorators.py", line 82, in parser
    self._parser = self._parser()
  File "/home/mshal/mozilla-central-git/testing/mochitest/mach_commands.py", line 243, in setup_argument_parser
    ('.py', 'r', imp.PY_SOURCE))
  File "/usr/lib/python3.6/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/usr/lib/python3.6/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/mshal/mozilla-central-git/testing/mochitest/runtests.py", line 39, in <module>
    import urllib2
  File "/home/mshal/mozilla-central-git/build/mach_bootstrap.py", line 406, in __call__
    module = self._original_import(name, globals, locals, fromlist, level)

ahal, is there an easy fix here?

Flags: needinfo?(ahal)
Status: NEW → RESOLVED
Closed: 4 years ago
Flags: needinfo?(ahal)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.