Skip to content

Commit 62f1912

Browse files
committed
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.
1 parent 359274c commit 62f1912

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

src/runtimes/python/provider.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,14 @@ func (p *Provider) downloadAndExtract(version, downloadURL, archiveName string)
9191

9292
// determineSourceDir determines the source directory from extracted archive
9393
func determineSourceDir(extractDir string) string {
94-
if goruntime.GOOS == constants.OSWindows {
95-
// Windows embeddable: files are in extractDir root
96-
return extractDir
97-
}
98-
99-
// Unix python-build-standalone: files are in python/ subdirectory
94+
// python-build-standalone: files are in python/ subdirectory (all platforms)
10095
pythonSubdir := filepath.Join(extractDir, "python")
10196
if _, err := os.Stat(pythonSubdir); err == nil {
10297
return pythonSubdir
10398
}
10499

105100
// Fallback: use extractDir if python/ doesn't exist
101+
// (e.g., Windows embeddable packages from python.org have files in root)
106102
return extractDir
107103
}
108104

@@ -384,10 +380,10 @@ func (p *Provider) ExecutablePath(version string) (string, error) {
384380
// Determine executable name and path based on platform
385381
var pythonPath string
386382
if goruntime.GOOS == constants.OSWindows {
387-
// Windows embeddable package has python.exe in root
383+
// Windows: python.exe is in the installation root
388384
pythonPath = filepath.Join(installPath, "python.exe")
389385
} else {
390-
// Unix has python in bin/
386+
// Unix: python is in bin/ subdirectory
391387
pythonPath = filepath.Join(installPath, "bin", "python")
392388
}
393389

0 commit comments

Comments
 (0)