diff options
author | Demon000 <demonsingur@gmail.com> | 2017-08-02 17:26:12 +0300 |
---|---|---|
committer | Demon000 <demonsingur@gmail.com> | 2017-10-06 20:23:41 +0300 |
commit | 4c845cf92b53c060d761ddf03eb196beee462936 (patch) | |
tree | 0849a7778d0cc4840e68cd43d52cf5b9a69ecbab | |
parent | a25089d4e53a84eb10411891da5e49ff7449567d (diff) | |
download | scripts-4c845cf92b53c060d761ddf03eb196beee462936.tar.gz scripts-4c845cf92b53c060d761ddf03eb196beee462936.tar.bz2 scripts-4c845cf92b53c060d761ddf03eb196beee462936.zip |
maintainers.py: check if official TWRP is available
Change-Id: Idec0f48a5a4651b6204465893efa841366c1e638
-rwxr-xr-x | maintainer-checks/maintainers.py | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/maintainer-checks/maintainers.py b/maintainer-checks/maintainers.py index 440248f..aca3424 100755 --- a/maintainer-checks/maintainers.py +++ b/maintainer-checks/maintainers.py @@ -5,6 +5,7 @@ import re import os import json import argparse +import urllib.request, urllib.error mydir = os.path.dirname(os.path.abspath(__file__)) @@ -99,11 +100,25 @@ for codename in codenames: print("{} doesn't have a root method field".format(codename)) except KeyError: print("{} doesn't have an install method field".format(codename)) + try: - if yml["twrp_site"]: - print("{} uses unofficial TWRP".format(codename)) - except KeyError: - pass + if "custom_twrp_codename" in yml: + twrp_url = "https://dl.twrp.me/" + yml["custom_twrp_codename"] + else: + twrp_url = "https://dl.twrp.me/" + codename + + conn = urllib.request.urlopen(twrp_url) + except urllib.error.HTTPError: + if "custom_twrp_link" in yml: + try: + conn = urllib.request.urlopen(yml["custom_twrp_link"]) + except urllib.error.HTTPError: + print("{} has an invalid custom twrp link value".format(codename)) + else: + print("{} doesn't have official twrp or a custom twrp link field".format(codename)) + else: + if "custom_twrp_link" in yml: + print("{} has both official twrp and a custom twrp link listed".format(codename)) wiki_yml_dir = os.path.join(mydir, repo["wiki"] + "/_data/devices") for wiki_yml in os.listdir(wiki_yml_dir): |