mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-23 04:04:15 +08:00
[tools] Add toolchain detection in sdk packages (#8827)
This commit is contained in:
+13
-1
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user