MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / detect

Method detect

tools/ng/toolchain.py:75–95  ·  view source on GitHub ↗

Detect GCC toolchain.

(self)

Source from the content-addressed store, hash-verified

73 return "gcc"
74
75 def detect(self) -> bool:
76 """Detect GCC toolchain."""
77 gcc_path = shutil.which(self.prefix + "gcc")
78 if not gcc_path:
79 return False
80
81 # Get version
82 ret, stdout, _ = self._run_command([gcc_path, "--version"])
83 if ret == 0:
84 lines = stdout.split('\n')
85 if lines:
86 version = lines[0].split()[-1]
87 self.info = ToolchainInfo(
88 name="gcc",
89 version=version,
90 path=os.path.dirname(gcc_path),
91 prefix=self.prefix
92 )
93 return True
94
95 return False
96
97 def configure_environment(self, env) -> None:
98 """Configure environment for GCC."""

Callers

nothing calls this directly

Calls 2

ToolchainInfoClass · 0.85
_run_commandMethod · 0.80

Tested by

no test coverage detected