From 62f19126d7315037240692ef54b5227bd4428598 Mon Sep 17 00:00:00 2001 From: "Calvin A. Allen" Date: Tue, 16 Dec 2025 10:23:57 -0500 Subject: [PATCH] fix(providers): handle python-build-standalone on Windows The python-build-standalone archives extract with a python/ subdirectory on all platforms, including Windows. Previously, the code assumed Windows would use the embeddable package format (files in root), causing the shim to fail to find the Python executable after installation. This change removes the Windows-specific case in determineSourceDir() and lets all platforms use the same logic: check for python/ subdirectory first, then fall back to the extract root for older embeddable packages. --- src/runtimes/python/provider.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/runtimes/python/provider.go b/src/runtimes/python/provider.go index e3730de..889045f 100644 --- a/src/runtimes/python/provider.go +++ b/src/runtimes/python/provider.go @@ -91,18 +91,14 @@ func (p *Provider) downloadAndExtract(version, downloadURL, archiveName string) // determineSourceDir determines the source directory from extracted archive func determineSourceDir(extractDir string) string { - if goruntime.GOOS == constants.OSWindows { - // Windows embeddable: files are in extractDir root - return extractDir - } - - // Unix python-build-standalone: files are in python/ subdirectory + // python-build-standalone: files are in python/ subdirectory (all platforms) pythonSubdir := filepath.Join(extractDir, "python") if _, err := os.Stat(pythonSubdir); err == nil { return pythonSubdir } // Fallback: use extractDir if python/ doesn't exist + // (e.g., Windows embeddable packages from python.org have files in root) return extractDir } @@ -384,10 +380,10 @@ func (p *Provider) ExecutablePath(version string) (string, error) { // Determine executable name and path based on platform var pythonPath string if goruntime.GOOS == constants.OSWindows { - // Windows embeddable package has python.exe in root + // Windows: python.exe is in the installation root pythonPath = filepath.Join(installPath, "python.exe") } else { - // Unix has python in bin/ + // Unix: python is in bin/ subdirectory pythonPath = filepath.Join(installPath, "bin", "python") }