mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1512487 - Part 1: Allow lints to inspect part of the build environment. r=ahal
This allows lints to "condition" themselves on having a build environment or a specific build application. It also adds the "name" parameter, so that setup functions can be shared across lints. `MozbuildObject` cannot be used as parameters to functions distributed via multiprocessing, since they cannot be pickled (due, currently, to internal terminal handles). Therefore we extract just a few key parts of the environment to expose. Differential Revision: https://phabricator.services.mozilla.com/D35274 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
524e59dc74
commit
fd38e457ec
@ -4,6 +4,7 @@
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import copy
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
@ -134,7 +135,9 @@ class LintRoller(object):
|
||||
continue
|
||||
|
||||
try:
|
||||
res = findobject(linter['setup'])(**self.lintargs)
|
||||
setupargs = copy.deepcopy(self.lintargs)
|
||||
setupargs['name'] = linter['name']
|
||||
res = findobject(linter['setup'])(**setupargs)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
res = 1
|
||||
|
@ -5,9 +5,11 @@
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import argparse
|
||||
import copy
|
||||
import os
|
||||
|
||||
from mozbuild.base import (
|
||||
BuildEnvironmentNotFoundException,
|
||||
MachCommandBase,
|
||||
)
|
||||
|
||||
@ -58,6 +60,15 @@ class MachCommands(MachCommandBase):
|
||||
self._activate_virtualenv()
|
||||
from mozlint import cli, parser
|
||||
|
||||
try:
|
||||
buildargs = {}
|
||||
buildargs['substs'] = copy.deepcopy(dict(self.substs))
|
||||
buildargs['defines'] = copy.deepcopy(dict(self.defines))
|
||||
buildargs['topobjdir'] = self.topobjdir
|
||||
lintargs.update(buildargs)
|
||||
except BuildEnvironmentNotFoundException:
|
||||
pass
|
||||
|
||||
lintargs.setdefault('root', self.topsrcdir)
|
||||
lintargs['exclude'] = get_global_excludes(lintargs['root'])
|
||||
cli.SEARCH_PATHS.append(here)
|
||||
|
Loading…
Reference in New Issue
Block a user