1#!/usr/bin/env nix-shell
2#!nix-shell -i python3 -p nix-update nix-prefetch-github python3Packages.requests
3
4from nix_prefetch_github import *
5import json
6import requests
7import subprocess
8
9REPOS = [ "libime", "xcb-imdkit", "fcitx5", "fcitx5-gtk", "fcitx5-qt", "fcitx5-configtool", "fcitx5-lua",
10 "fcitx5-rime", "fcitx5-chinese-addons", "fcitx5-table-extra", "fcitx5-table-other" ]
11
12OWNER = "fcitx"
13
14def get_latest_tag(repo, owner=OWNER):
15 r = requests.get('https://api.github.com/repos/{}/{}/tags'.format(owner,repo))
16 return r.json()[0].get("name")
17
18def main():
19 sources = dict()
20 for repo in REPOS:
21 rev = get_latest_tag(repo)
22 if repo == "fcitx5-qt":
23 subprocess.run(["nix-update", "--commit", "--version", rev, "libsForQt5.{}".format(repo)])
24 else:
25 subprocess.run(["nix-update", "--commit", "--version", rev, repo])
26
27if __name__ == "__main__":
28 main ()