[tools] Add toolchain detection in sdk packages (#8827)

This commit is contained in:
Bernard Xiong
2024-04-21 00:53:17 +08:00
committed by GitHub
parent 732d32be09
commit b76dca8f4f
3 changed files with 85 additions and 3 deletions
+13 -1
View File
@@ -20,7 +20,7 @@
# Change Logs:
# Date Author Notes
# 2015-01-20 Bernard Add copyright information
#
# 2024-04-21 Bernard Add ImportModule to import local module
import sys
import os
@@ -291,3 +291,15 @@ def ReloadModule(module):
importlib.reload(module)
else:
reload(module)
def ImportModule(module):
import sys
if sys.version_info.major >= 3:
import importlib.util
path = os.path.dirname(__file__)
spec = importlib.util.spec_from_file_location(module, os.path.join(path, module+".py"))
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
else:
return __import__(module, fromlist=[module])