blob: 00b49394bc5ef87ca72c2075546c330a883cb8c7 [file] [log] [blame]
# Copyright (c) 2012 The Chromium OS Authors.
# SPDX-License-Identifier: GPL-2.0+
import command
import gitutil
import os
def FindGetMaintainer():
"""Look for the script.
If the script is found we'll return a path to it; else None.
try_list = [
os.path.join(gitutil.GetTopLevel(), 'scripts'),
# Look in the list
for path in try_list:
fname = os.path.join(path, '')
if os.path.isfile(fname):
return fname
return None
def GetMaintainer(fname, verbose=False):
"""Run on a file if we find it.
We look for in the 'scripts' directory at the top of
git. If we find it we'll run it. If we don't find
then we fail silently.
fname: Path to the patch file to run on.
A list of email addresses to CC to.
get_maintainer = FindGetMaintainer()
if not get_maintainer:
if verbose:
print "WARNING: Couldn't find"
return []
stdout = command.Output(get_maintainer, '--norolestats', fname)
return stdout.splitlines()