From 3d8fe457d561b9b859b9335600af465fe11be778 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Thu, 28 Jul 2016 18:32:41 -0700 Subject: [PATCH] Added buildscript for authors. --- AUTHORS.rst | 27 ++++++++++--------- scripts/build_authors.py | 57 ++++++++++++++++++++++++++++++++++++++++ scripts/build_manpage.py | 3 +++ 3 files changed, 75 insertions(+), 12 deletions(-) create mode 100755 scripts/build_authors.py mode change 100644 => 100755 scripts/build_manpage.py diff --git a/AUTHORS.rst b/AUTHORS.rst index b0ce92a..e9e35f3 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -1,4 +1,3 @@ - ================ RTV Contributors ================ @@ -7,22 +6,26 @@ Thanks to the following people for their contributions to this project. * `Michael Lazar `_ * `Tobin Brown `_ +* `woorst `_ * `Théo Piboubès `_ * `Yusuke Sakamoto `_ * `Johnathan Jenkins `_ -* `obosob `_ +* `Gustavo Zambonin `_ * `mekhami `_ -* `Noah Morrison `_ +* `obosob `_ * `Toby Hughes `_ -* `Shawn Hind `_ +* `Noah Morrison `_ +* `mardiqwop `_ +* `Shawn Hind `_ +* `5225225 `_ * `JuanPablo `_ * `Robert Greener `_ -* `peterpans01 `_ -* `Adam Talsma `_ +* `afloofloo `_ +* `Matthew Smith `_ +* `Marc Abramowitz `_ +* `Hans Roman `_ * `Ram-Z `_ -* `mralext20 `_ -* `Wieland Hoffmann `_ -* `Marc Abramowitz `_ -* `Hans Roman `_ -* `Gustavo Zambonin `_ - +* `Wieland Hoffmann `_ +* `Adam Talsma `_ +* `Alexander Terry `_ +* `peterpans01 `_ \ No newline at end of file diff --git a/scripts/build_authors.py b/scripts/build_authors.py new file mode 100755 index 0000000..4cfb790 --- /dev/null +++ b/scripts/build_authors.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Scrape the project contributors list from Github and update AUTHORS.rst +""" + +from __future__ import unicode_literals +import os +import time +import logging + +import requests + +_filepath = os.path.dirname(os.path.relpath(__file__)) + +FILENAME = os.path.abspath(os.path.join(_filepath, '..', 'AUTHORS.rst')) +URL = "https://api.github.com/repos/michael-lazar/rtv/contributors" +HEADER = """\ +================ +RTV Contributors +================ + +Thanks to the following people for their contributions to this project. + +""" + +def main(): + + logging.captureWarnings(True) + + # Request the list of contributors + print('GET {}'.format(URL)) + resp = requests.get(URL) + contributors = resp.json() + + lines = [] + for contributor in contributors: + time.sleep(1.0) + + # Request each contributor individually to get the full name + print('GET {}'.format(contributor['url'])) + resp = requests.get(contributor['url']) + user = resp.json() + + name = user.get('name') or user['login'] + url = user['html_url'] + lines.append('* `{} <{}>`_'.format(name, url)) + + print('Writing to {}'.format(FILENAME)) + text = HEADER + '\n'.join(lines) + text = text.encode('utf-8') + with open(FILENAME, 'wb') as fp: + fp.write(text) + +if __name__ == '__main__': + main() diff --git a/scripts/build_manpage.py b/scripts/build_manpage.py old mode 100644 new mode 100755 index 81f5ec1..07f4318 --- a/scripts/build_manpage.py +++ b/scripts/build_manpage.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + """ Internal tool used to automatically generate an up-to-date version of the rtv man page. Currently this script should be manually ran after each version bump. @@ -6,6 +8,7 @@ In the future, it would be nice to have this functionality built into setup.py. Usage: $ python scripts/build_manpage.py """ + import os import sys from datetime import datetime