Skip to content

Commit 2dde08d

Browse files
committed
fix: add the python base_exec_prefix path for all OS
1 parent d2f3163 commit 2dde08d

File tree

6 files changed

+15
-30
lines changed

6 files changed

+15
-30
lines changed

dist/node12/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node12/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node16/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node16/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/python/python.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export async function setupPythonViaSystem(
4848
join(setupDir, "python.exe")
4949
const pythonSetupDir = dirname(pythonBinPath)
5050
/** The directory which the tool is installed to */
51-
await activateWinPython(pythonSetupDir)
51+
await addPath(pythonSetupDir)
5252
return { installDir: pythonSetupDir, binDir: pythonSetupDir }
5353
}
5454
case "darwin": {
@@ -75,8 +75,3 @@ export async function setupPythonViaSystem(
7575
}
7676
}
7777
}
78-
79-
async function activateWinPython(binDir: string) {
80-
info(`Add ${binDir} to PATH`)
81-
await addPath(binDir)
82-
}

src/utils/setup/setupPipPack.ts

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,27 +65,17 @@ export async function setupPipPack(name: string, version?: string): Promise<Inst
6565
})
6666

6767
if (binDir === undefined) {
68-
if (process.platform === "linux") {
69-
binDir = "/home/runner/.local/bin/"
70-
} else if (process.platform === "darwin") {
71-
binDir = "/usr/local/bin/"
72-
} else {
73-
// windows or others
74-
try {
75-
binDir = join(
76-
(await getExecOutput(`${python} -c "import sys;print(sys.base_exec_prefix);"`)).stdout.trim(),
77-
"Scripts"
78-
)
79-
} catch {
80-
binDir = join(
81-
(await getExecOutput(`${python} -c "import sys;print(sys.base_exec_prefix);"`)).stdout.trim(),
82-
"Scripts"
83-
)
84-
}
85-
}
86-
info(`${binDir} to PATH`)
87-
await addPath(binDir)
68+
binDir = await addPythonBaseExecPrefix()
8869
}
8970

9071
return { binDir }
9172
}
73+
74+
async function addPythonBaseExecPrefix() {
75+
const base_exec_prefix = join(
76+
(await getExecOutput(`${python} -c "import sys;print(sys.base_exec_prefix);"`)).stdout.trim(),
77+
"Scripts"
78+
)
79+
await addPath(base_exec_prefix)
80+
return base_exec_prefix
81+
}

0 commit comments

Comments
 (0)