about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/inputmethods/fcitx5/update.py
blob: 205705700404c4754569412d0d87125494e26854 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p nix-update nix-prefetch-github python3Packages.requests

from nix_prefetch_github import *
import json
import requests
import subprocess

REPOS = [
        "libime",
        "xcb-imdkit",

        "fcitx5",
        "fcitx5-chewing",
        "fcitx5-chinese-addons",
        "fcitx5-configtool",
        "fcitx5-gtk",
        "fcitx5-hangul",
        "fcitx5-lua",
        "fcitx5-m17n",
        "fcitx5-qt",
        "fcitx5-rime",
        "fcitx5-table-extra",
        "fcitx5-table-other",
        "fcitx5-unikey"
        ]

OWNER = "fcitx"

def get_latest_tag(repo, owner=OWNER):
    r = requests.get('https://api.github.com/repos/{}/{}/tags'.format(owner,repo))
    return r.json()[0].get("name")

def main():
    sources = dict()
    for repo in REPOS:
        rev = get_latest_tag(repo)
        if repo == "fcitx5-qt":
            subprocess.run(["nix-update", "--commit", "--version", rev, "libsForQt5.{}".format(repo)])
        else:
            subprocess.run(["nix-update", "--commit", "--version", rev, repo])

if __name__ == "__main__":
    main ()