blob: fdc7f980325f523657bc25b33f837308993a68e0 (
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[f"tools.datasources.{func_name}"],
f"create_{func_name}")(config))
print("Done loading datasources!")
|