Bug 1713683 - Run setup function with lintargs including log and virtual env binary path. r=ahal

This was oversight from Bug 1713178, which made black's `setup`
function require them but didn't bump the test.

Differential Revision: https://phabricator.services.mozilla.com/D116493
This commit is contained in:
Nick Alexander 2021-06-02 21:24:49 +00:00
parent 789bc7cc92
commit 16ab993262
2 changed files with 12 additions and 4 deletions

View File

@ -114,11 +114,10 @@ def setup(root, **lintargs):
log = lintargs["log"]
virtualenv_bin_path = lintargs.get("virtualenv_bin_path")
# Using `which` searches multiple directories and handles `.exe` on Windows.
binary = mozpath.normsep(
which("black", path=(virtualenv_bin_path, default_bindir()))
)
binary = which("black", path=(virtualenv_bin_path, default_bindir()))
if binary and os.path.exists(binary):
binary = mozpath.normsep(binary)
log.debug("Looking for black at {}".format(binary))
version = get_black_version(binary)
versions = [

View File

@ -93,8 +93,17 @@ def run_setup(config):
if "setup" not in config:
return
log = logging.LoggerAdapter(
logger, {"lintname": config.get("name"), "pid": os.getpid()}
)
func = findobject(config["setup"])
func(build.topsrcdir, virtualenv_manager=build.virtualenv_manager)
func(
build.topsrcdir,
virtualenv_manager=build.virtualenv_manager,
virtualenv_bin_path=build.virtualenv_manager.bin_path,
log=log,
)
@pytest.fixture