mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-21 17:38:51 +09:00
![Simon Glass](/assets/img/avatar_default.png)
At present patman sets the python path on startup so that it can access the libraries it needs. If we convert to use absolute imports this is not necessary. Move patman to use absolute imports. This requires changes in tools which use the patman libraries (which is most of them). Signed-off-by: Simon Glass <sjg@chromium.org>
49 lines
1.3 KiB
Python
49 lines
1.3 KiB
Python
# SPDX-License-Identifier: GPL-2.0+
|
|
# Copyright (c) 2012 The Chromium OS Authors.
|
|
#
|
|
|
|
import os
|
|
|
|
from patman import command
|
|
from patman import gitutil
|
|
|
|
def FindGetMaintainer():
|
|
"""Look for the get_maintainer.pl script.
|
|
|
|
Returns:
|
|
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, 'get_maintainer.pl')
|
|
if os.path.isfile(fname):
|
|
return fname
|
|
|
|
return None
|
|
|
|
def GetMaintainer(fname, verbose=False):
|
|
"""Run get_maintainer.pl on a file if we find it.
|
|
|
|
We look for get_maintainer.pl in the 'scripts' directory at the top of
|
|
git. If we find it we'll run it. If we don't find get_maintainer.pl
|
|
then we fail silently.
|
|
|
|
Args:
|
|
fname: Path to the patch file to run get_maintainer.pl on.
|
|
|
|
Returns:
|
|
A list of email addresses to CC to.
|
|
"""
|
|
get_maintainer = FindGetMaintainer()
|
|
if not get_maintainer:
|
|
if verbose:
|
|
print("WARNING: Couldn't find get_maintainer.pl")
|
|
return []
|
|
|
|
stdout = command.Output(get_maintainer, '--norolestats', fname)
|
|
lines = stdout.splitlines()
|
|
return [ x.replace('"', '') for x in lines ]
|