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

Function getWindowsDefaultPythonVersion

buildtools/setup_python.go:311–338  ·  view source on GitHub ↗

getWindowsDefaultPythonVersion reads Python version from static TOML.

()

Source from the content-addressed store, hash-verified

309
310// getWindowsDefaultPythonVersion reads Python version from static TOML.
311func getWindowsDefaultPythonVersion() string {
312 // Determine current architecture.
313 arch := runtime.GOARCH
314 switch arch {
315 case "amd64", "x86_64":
316 arch = "x86_64"
317 case "arm64":
318 arch = "aarch64"
319 }
320
321 staticFile := fmt.Sprintf("static/%s-%s.toml", arch, runtime.GOOS)
322 bytes, err := static.ReadFile(staticFile)
323 if err != nil {
324 panic(fmt.Sprintf("failed to read %s", staticFile))
325 }
326
327 var buildTools BuildTools
328 if err := toml.Unmarshal(bytes, &buildTools); err != nil {
329 panic(fmt.Sprintf("failed to decode %s: %s", staticFile, err))
330 }
331
332 pythonTool, err := buildTools.findTool(nil, "python3")
333 if err == nil && pythonTool != nil && pythonTool.Version != "" {
334 return pythonTool.Version
335 }
336
337 panic("failed to read windows default python version")
338}
339
340func shouldUseConda(ctx context.Context) bool {
341 // If no Python config or version is specified, use system Python.

Callers 1

GetDefaultPythonVersionFunction · 0.85

Calls 2

findToolMethod · 0.95
SprintfMethod · 0.80

Tested by

no test coverage detected