瀏覽代碼

[tools] fix EXEC_PATH exists, but the CC does not.

bernard 1 年之前
父節點
當前提交
582d11faad
共有 1 個文件被更改,包括 7 次插入7 次删除
  1. 7 7
      tools/building.py

+ 7 - 7
tools/building.py

@@ -195,23 +195,23 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
         os.environ['RTT_CC_PREFIX'] = exec_prefix
         os.environ['RTT_CC_PREFIX'] = exec_prefix
 
 
     # auto change the 'RTT_EXEC_PATH' when 'rtconfig.EXEC_PATH' get failed
     # auto change the 'RTT_EXEC_PATH' when 'rtconfig.EXEC_PATH' get failed
-    if not os.path.exists(rtconfig.EXEC_PATH):
+    if not os.path.exists(os.path.join(rtconfig.EXEC_PATH, rtconfig.CC)):
         if 'RTT_EXEC_PATH' in os.environ:
         if 'RTT_EXEC_PATH' in os.environ:
             # del the 'RTT_EXEC_PATH' and using the 'EXEC_PATH' setting on rtconfig.py
             # del the 'RTT_EXEC_PATH' and using the 'EXEC_PATH' setting on rtconfig.py
             del os.environ['RTT_EXEC_PATH']
             del os.environ['RTT_EXEC_PATH']
 
 
         try:
         try:
             # try to detect toolchains in env
             # try to detect toolchains in env
-            from utils import ImportModule
-            envm = ImportModule('env')
+            envm = utils.ImportModule('env')
             # from env import GetSDKPath
             # from env import GetSDKPath
             exec_path = envm.GetSDKPath(rtconfig.CC)
             exec_path = envm.GetSDKPath(rtconfig.CC)
             if 'gcc' in rtconfig.CC:
             if 'gcc' in rtconfig.CC:
                 exec_path = os.path.join(exec_path, 'bin')
                 exec_path = os.path.join(exec_path, 'bin')
-                if os.path.exists(exec_path):
-                    print('set CC to ' + exec_path)
-                    rtconfig.EXEC_PATH = exec_path
-                    os.environ['RTT_EXEC_PATH'] = exec_path
+
+            if os.path.exists(exec_path):
+                print('set CC to ' + exec_path)
+                rtconfig.EXEC_PATH = exec_path
+                os.environ['RTT_EXEC_PATH'] = exec_path
         except Exception as e:
         except Exception as e:
             # detect failed, ignore
             # detect failed, ignore
             pass
             pass