blob: 3b1be19aab4ca6e685fb0bc85e1b8e4d03d56b93 (
plain)
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
|
import json
class Repo:
def __init__(self, name, url, branch, tag):
self.name = name
self.url = url
self.branch = branch
self.tag = tag
if self.branch is None and self.tag is None:
self.branch = "master"
sub_repos = []
def get_by_url(url):
for repo in sub_repos:
if repo.url == url:
return repo
if url.startswith("https://github.com"):
if repo.url == url.replace("git://", "https://"):
return repo
return None
def get_sub_repos():
return sub_repos
def load_modules(path):
for module in json.load(open(path)):
if get_by_url(module["repo"]) is None:
sub_repos.append(Repo(name=module["name"],
url=module["repo"],
branch=module.get("branch", None),
tag=module.get("tag", None)))
load_modules("modules.json")
|