summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2014-01-17 22:07:48 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2014-01-17 22:07:48 -0500
commit3c7fc0c1d1226541b41a7bfd71f187225c226250 (patch)
tree9d06d1163db0dec6f441f56f05487aa2b2d2d599
parent804c246e05d448df47261bdd204002b5b7424983 (diff)
downloadpycurl-3c7fc0c1d1226541b41a7bfd71f187225c226250.tar.gz
Tool to manage contributors in the authors file
-rw-r--r--setup.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index 3be87c8..8979df2 100644
--- a/setup.py
+++ b/setup.py
@@ -439,6 +439,32 @@ def check_manifest():
if not included:
print(path)
+AUTHORS_PARAGRAPH = 3
+
+def check_authors():
+ f = open('AUTHORS')
+ try:
+ contents = f.read()
+ finally:
+ f.close()
+
+ paras = contents.split("\n\n")
+ authors_para = paras[AUTHORS_PARAGRAPH]
+ authors = [author for author in authors_para.strip().split("\n")]
+
+ log = subprocess.check_output(['git', 'log', '--format=%an (%ae)'])
+ for author in log.strip().split("\n"):
+ author = author.replace('@', ' at ').replace('(', '<').replace(')', '>')
+ if author not in authors:
+ authors.append(author)
+ authors.sort()
+ paras[AUTHORS_PARAGRAPH] = "\n".join(authors)
+ f = open('AUTHORS', 'w')
+ try:
+ f.write("\n\n".join(paras))
+ finally:
+ f.close()
+
###############################################################################
setup_args = dict(
@@ -513,6 +539,8 @@ if __name__ == "__main__":
setup(**setup_args)
elif len(sys.argv) > 1 and sys.argv[1] == 'manifest':
check_manifest()
+ elif len(sys.argv) > 1 and sys.argv[1] == 'authors':
+ check_authors()
else:
setup_args['data_files'] = get_data_files()
ext = get_extension()