From 0487e4eebf473fed91e05496df131c7d32074665 Mon Sep 17 00:00:00 2001 From: windowsboy111 Date: Tue, 22 Nov 2022 21:23:25 +0800 Subject: [PATCH] chkupdate: naikai-fonts --- anda/fonts/naikai/chkupdate.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 anda/fonts/naikai/chkupdate.py diff --git a/anda/fonts/naikai/chkupdate.py b/anda/fonts/naikai/chkupdate.py new file mode 100644 index 0000000000..6e58f7034b --- /dev/null +++ b/anda/fonts/naikai/chkupdate.py @@ -0,0 +1,19 @@ +import os +import requests +import re + +NAME = 'naikai-fonts' +REPO = "max32002/naikaifont" +REGEX_VER = r'Version:\s*([\.\d]+)\n' +SPEC = f"{NAME}.spec" +LINK = f'https://api.github.com/repos/{REPO}/releases/latest' + + +ver = requests.get(LINK).json()['tag_name'] +with open(SPEC, 'r') as f: + matches = re.findall(REGEX_VER, f.read()) +if not len(matches): exit(f"{NAME}: Failed to match regex!") +cur = matches[0] +if ver == cur: exit(f'{NAME}: Up to date!') +print(f'{NAME}: {cur} -> {ver}') +os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')