Closed Bug 1585385 Opened 10 months ago Closed 9 months ago

pre-commit link hook in .hgrc causes "ImportError: cannot import name get_context"

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox71 fixed)

RESOLVED FIXED
mozilla71
Tracking Status
firefox71 --- fixed

People

(Reporter: mjf, Assigned: ahal)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: in-triage)

Attachments

(1 file)

MJF-MacBookPro:moz-central mfroman$ hg commit -m "will delete"
Error running mach:

['lint', '--quiet', '--workdir=staged']

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

You can invoke |./mach busted| to check if this issue is already on file. If it
isn't, please use |./mach busted file| to report it. If |./mach busted| is
misbehaving, you can also inspect the dependencies of bug 1543241.

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

The details of the failure are as follows:

ImportError: cannot import name get_context

File "/Users/mfroman/mozilla/moz-central/python/mach/mach/main.py", line 360, in run
return self._run(argv)
File "/Users/mfroman/mozilla/moz-central/python/mach/mach/main.py", line 417, in _run
args = parser.parse_args(argv)
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1701, in parse_args
args, argv = self.parse_known_args(args, namespace)
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1733, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1921, in _parse_known_args
positionals_end_index = consume_positionals(start_index)
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1898, in consume_positionals
take_action(action, args)
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1807, in take_action
action(self, namespace, argument_values, option_string)
File "/Users/mfroman/mozilla/moz-central/python/mach/mach/dispatcher.py", line 179, in call
if handler.parser:
File "/Users/mfroman/mozilla/moz-central/python/mach/mach/decorators.py", line 82, in parser
self._parser = self._parser()
File "/Users/mfroman/mozilla/moz-central/tools/lint/mach_commands.py", line 34, in setup_argument_parser
from mozlint import cli
File "/Users/mfroman/mozilla/moz-central/build/mach_bootstrap.py", line 406, in call
module = self._original_import(name, globals, locals, fromlist, level)
File "/Users/mfroman/mozilla/moz-central/python/mozlint/mozlint/init.py", line 6, in <module>
from .roller import LintRoller
File "/Users/mfroman/mozilla/moz-central/build/mach_bootstrap.py", line 406, in call
module = self._original_import(name, globals, locals, fromlist, level)
File "/Users/mfroman/mozilla/moz-central/python/mozlint/mozlint/roller.py", line 17, in <module>
from multiprocessing import cpu_count, get_context

As a workaround, I can remove the following lines from my .hgrc file:
[hooks]
pretxncommit.lint = python:tools/lint/hooks.py:hg

:ahal, any input on what might be happening here? The stack here seems to end in mozlint although it's called from an hg hook.

Flags: needinfo?(ahal)

Sorry, bug 1580280 dropped support for Python 2 in |mach lint| and I forgot to update the hook.

Assignee: nobody → ahal
Status: NEW → ASSIGNED
Flags: needinfo?(ahal)
Regressed by: 1580280
Pushed by ahalberstadt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fed9e006aff9
[lint] Make sure hooks run |mach lint| with Python 3, r=mars
Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
You need to log in before you can comment on or make changes to this bug.