blob: 8d74202a58b3c9aa9ddad82a04ea8f6c76bd2c4d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# Copyright (C) 2021 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
import sys
from gerrit import GerritClient
from tools.namespace import Namespace
class Datasources(Namespace):
gerrit_client: GerritClient = None
def load_datasources(self, config):
print("Discovering and configuring datasources...")
datasource_names = [o for o in Datasources.__dict__.keys() if o.endswith("_client")]
for func_name in datasource_names:
dict.__setattr__(self, func_name,
getattr(sys.modules["tools.datasources." + func_name],
"create_" + func_name)(config))
print("Done loading datasources!")
|