From: Daniele Varrazzo Date: Fri, 4 Dec 2020 04:33:28 +0000 (+0000) Subject: Backers file updated X-Git-Tag: 3.0.dev0~284 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6526f6a7291747c1eb1d8114476879d24734901b;p=thirdparty%2Fpsycopg.git Backers file updated Added scripts to help maintaining it. --- diff --git a/.gitignore b/.gitignore index b8fb5f22d..ce3d2e051 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ __pycache__/ /docs/_build/ /docs/.venv/ +*.html diff --git a/BACKERS.md b/BACKERS.md index 2ca327232..420b2792b 100644 --- a/BACKERS.md +++ b/BACKERS.md @@ -7,4 +7,16 @@ Thank you very much for supporting the project! ## Github Sponsors - + + + + + + + + + + + + + diff --git a/tools/add_backer.py b/tools/add_backer.py new file mode 100755 index 000000000..48040497b --- /dev/null +++ b/tools/add_backer.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +r"""Add a github user to the backers file + +Print the tag to represent an user. + +Hint: to reprocess the list of users you can use: + + grep "github.com.*100" BACKERS.md \ + | sed 's|\(.*github.com/\)\([^"]\+\)\(.*\)|\2|' \ + | xargs ./tools/add_backer.py --big + + grep "github.com.*60" BACKERS.md \ + | sed 's|\(.*github.com/\)\([^"]\+\)\(.*\)|\2|' \ + | xargs ./tools/add_backer.py +""" + +import sys +import html +import logging +import requests + +logger = logging.getLogger() +logging.basicConfig( + level=logging.INFO, + format='%(asctime)s %(levelname)s %(message)s') + + +def main(): + opt = parse_cmdline() + tags = [] + for username in opt.username: + logger.info("fetching %s", username) + resp = requests.get( + f"https://api.github.com/users/{username}", + headers={"Accept": "application/vnd.github.v3+json"}, + ) + size = 100 if opt.big else 60 + resp.raise_for_status() + data = resp.json() + tags.append( + f"""""" + f"""""" + ) + for tag in tags: + print(tag) + + +def parse_cmdline(): + from argparse import ArgumentParser + + parser = ArgumentParser(description=__doc__) + parser.add_argument("username", nargs="*", help="github user to add") + parser.add_argument("--big", action="store_true", help="make them larger") + + opt = parser.parse_args() + + return opt + + +if __name__ == "__main__": + sys.exit(main())