MCPcopy Index your code
hub / github.com/celer-pkg/celer / FindBuildTool

Function FindBuildTool

buildtools/build_tools.go:323–352  ·  view source on GitHub ↗

FindBuildTool find build tool with tool name.

(ctx context.Context, nameVersion string)

Source from the content-addressed store, hash-verified

321
322// FindBuildTool find build tool with tool name.
323func FindBuildTool(ctx context.Context, nameVersion string) (*BuildTool, error) {
324 // Determine current architecture
325 arch := runtime.GOARCH
326 switch arch {
327 case "amd64", "x86_64":
328 arch = "x86_64"
329 case "arm64":
330 arch = "aarch64"
331 }
332
333 // Read the static TOML file for the current platform
334 staticFile := fmt.Sprintf("static/%s-%s.toml", arch, runtime.GOOS)
335 bytes, err := static.ReadFile(staticFile)
336 if err != nil {
337 return nil, fmt.Errorf("failed to read TOML config %s -> %w", staticFile, err)
338 }
339
340 var buildTools BuildTools
341 if err := toml.Unmarshal(bytes, &buildTools); err != nil {
342 return nil, fmt.Errorf("failed to parse TOML config %s -> %w", staticFile, err)
343 }
344
345 // Find the tool entry.
346 condaTool, err := buildTools.findTool(ctx, nameVersion)
347 if err != nil {
348 return nil, fmt.Errorf("failed to find matched tool %s -> %w", nameVersion, err)
349 }
350
351 return condaTool, nil
352}

Callers 2

configureOptionsMethod · 0.92
setupPythonFunction · 0.85

Calls 2

findToolMethod · 0.95
SprintfMethod · 0.80

Tested by

no test coverage detected