summaryrefslogtreecommitdiff
path: root/tools/patman/get_maintainer.py
diff options
context:
space:
mode:
authorDoug Anderson <dianders@chromium.org>2012-12-03 14:43:16 +0000
committerSimon Glass <sjg@chromium.org>2013-01-31 15:23:39 -0800
commit21a19d70e2c2aa45cfe62c6adf8ceee9fcfbcacb (patch)
tree974b523f0ea6ea032b643e4ab250c14cba1c5733 /tools/patman/get_maintainer.py
parent311872551570a6439f62ab476c6fd4836a7a9aa7 (diff)
downloadu-boot-imx-21a19d70e2c2aa45cfe62c6adf8ceee9fcfbcacb.zip
u-boot-imx-21a19d70e2c2aa45cfe62c6adf8ceee9fcfbcacb.tar.gz
u-boot-imx-21a19d70e2c2aa45cfe62c6adf8ceee9fcfbcacb.tar.bz2
patman: Add a call to get_maintainer.pl if it exists
For Linux the best way to figure out where to send a patch is with the "get_maintainer.pl" script. Add support for calling it from patman. Support is added unconditionally for "scripts/get_maintainer.pl" in case it is helpful for any other projects. Signed-off-by: Doug Anderson <dianders@chromium.org>
Diffstat (limited to 'tools/patman/get_maintainer.py')
-rw-r--r--tools/patman/get_maintainer.py63
1 files changed, 63 insertions, 0 deletions
diff --git a/tools/patman/get_maintainer.py b/tools/patman/get_maintainer.py
new file mode 100644
index 0000000..cb11373
--- /dev/null
+++ b/tools/patman/get_maintainer.py
@@ -0,0 +1,63 @@
+# Copyright (c) 2012 The Chromium OS Authors.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+import command
+import gitutil
+import os
+
+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)
+ return stdout.splitlines()