Skip to content

Commit 88ef2fc

Browse files
authored
Merge pull request #230 from aminya/pipx [skip ci]
2 parents 4e8c2f8 + 5eefa3d commit 88ef2fc

File tree

8 files changed

+17
-11
lines changed

8 files changed

+17
-11
lines changed

dist/actions/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/actions/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/legacy/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/legacy/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/modern/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/modern/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: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ export async function setupPython(version: string, setupDir: string, arch: strin
4444
async function setupPipx(foundPython: string) {
4545
try {
4646
if (!(await hasPipx(foundPython))) {
47-
await setupPipPackWithPython(foundPython, "pipx", undefined, { upgrade: true, usePipx: false })
47+
try {
48+
await setupPipPackWithPython(foundPython, "pipx", undefined, { upgrade: true, usePipx: false })
49+
} catch (err) {
50+
if (setupPipPackSystem("pipx", false) === null) {
51+
throw new Error(`pipx was not installed correctly ${err}`)
52+
}
53+
}
4854
}
4955
await execa(foundPython, ["-m", "pipx", "ensurepath"], { stdio: "inherit" })
5056
await setupPipPackWithPython(foundPython, "venv", undefined, { upgrade: false, usePipx: false })

src/utils/setup/setupPipPack.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,15 @@ async function findBinDir(dirs: string[], name: string) {
174174
return dirs[dirs.length - 1]
175175
}
176176

177-
export function setupPipPackSystem(name: string) {
177+
export function setupPipPackSystem(name: string, addPythonPrefix = true) {
178178
if (process.platform === "linux") {
179179
info(`Installing ${name} via the system package manager`)
180180
if (isArch()) {
181-
return setupPacmanPack(`python-${name}`)
181+
return setupPacmanPack(addPythonPrefix ? `python-${name}` : name)
182182
} else if (hasDnf()) {
183-
return setupDnfPack([{ name: `python3-${name}` }])
183+
return setupDnfPack([{ name: addPythonPrefix ? `python3-${name}` : name }])
184184
} else if (isUbuntu()) {
185-
return setupAptPack([{ name: `python3-${name}` }])
185+
return setupAptPack([{ name: addPythonPrefix ? `python3-${name}` : name }])
186186
}
187187
}
188188
return null

0 commit comments

Comments
 (0)