xref: /linux/tools/testing/selftests/drivers/net/lib/py/remote.py (revision 621cde16e49b3ecf7d59a8106a20aaebfb4a59a9)
1*1a20a9a0SJakub Kicinski# SPDX-License-Identifier: GPL-2.0
2*1a20a9a0SJakub Kicinski
3*1a20a9a0SJakub Kicinskiimport os
4*1a20a9a0SJakub Kicinskiimport importlib
5*1a20a9a0SJakub Kicinski
6*1a20a9a0SJakub Kicinski_modules = {}
7*1a20a9a0SJakub Kicinski
8*1a20a9a0SJakub Kicinskidef Remote(kind, args, src_path):
9*1a20a9a0SJakub Kicinski    global _modules
10*1a20a9a0SJakub Kicinski
11*1a20a9a0SJakub Kicinski    if kind not in _modules:
12*1a20a9a0SJakub Kicinski        _modules[kind] = importlib.import_module("..remote_" + kind, __name__)
13*1a20a9a0SJakub Kicinski
14*1a20a9a0SJakub Kicinski    dir_path = os.path.abspath(src_path + "/../")
15*1a20a9a0SJakub Kicinski    return getattr(_modules[kind], "Remote")(args, dir_path)
16