-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathmirror-regen.py
executable file
·44 lines (36 loc) · 1 KB
/
mirror-regen.py
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 python3
import os
import sys
try:
from github import Github
except ImportError:
print("Please install the pygithub package via pip3")
exit(1)
e = os.environ.copy()
# Environment variables for github username and api token
try:
u = e["GHUSER"]
p = e["GHTOKEN"]
except KeyError:
print("Please set the GHUSER and GHTOKEN environment variables")
exit(1)
orgName = "LineageOS"
org = Github(u, p).get_user(orgName)
file = open("default.xml", "w")
file.write('<?xml version="1.0" encoding="UTF-8"?>\n')
file.write("<manifest>\n")
file.write("\n")
file.write(' <remote name="github"\n')
file.write(' fetch=".." />\n')
file.write("\n")
file.write(' <default revision="main"\n')
file.write(' remote="github"\n')
file.write(' sync-j="4" />\n')
file.write("\n")
repos = []
for repo in org.get_repos():
repos.append(repo.full_name)
for repo in sorted(repos):
file.write(' <project name="' + repo + '" />\n')
file.write("</manifest>\n")
file.close()