mirror of https://github.com/aminya/setup-cpp
fix: use pip3 if available
This commit is contained in:
parent
5f6e3a7053
commit
1ffc145596
|
@ -32,17 +32,19 @@
|
|||
},
|
||||
"prettier": "prettier-config-atomic",
|
||||
"dependencies": {
|
||||
"@actions/exec": "^1.1.0",
|
||||
"@actions/core": "^1.5.0",
|
||||
"@actions/exec": "^1.1.0",
|
||||
"@actions/io": "^1.1.1",
|
||||
"@actions/tool-cache": "^1.7.1",
|
||||
"hasha": "^5.2.2",
|
||||
"semver": "^7.3.5"
|
||||
"semver": "^7.3.5",
|
||||
"which": "^2.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.0.1",
|
||||
"@types/node": "^16.9.1",
|
||||
"@types/semver": "^7.3.8",
|
||||
"@types/which": "^2.0.1",
|
||||
"cross-env": "7.0.3",
|
||||
"eslint-config-atomic": "^1.16.2",
|
||||
"jest": "^27.2.0",
|
||||
|
|
|
@ -11,6 +11,7 @@ importers:
|
|||
'@types/jest': ^27.0.1
|
||||
'@types/node': ^16.9.1
|
||||
'@types/semver': ^7.3.8
|
||||
'@types/which': ^2.0.1
|
||||
cross-env: 7.0.3
|
||||
eslint-config-atomic: ^1.16.2
|
||||
hasha: ^5.2.2
|
||||
|
@ -23,6 +24,7 @@ importers:
|
|||
terser-config-atomic: ^0.1.1
|
||||
ts-jest: ^27.0.5
|
||||
typescript: ^4.4.3
|
||||
which: ^2.0.2
|
||||
dependencies:
|
||||
'@actions/core': 1.5.0
|
||||
'@actions/exec': 1.1.0
|
||||
|
@ -30,10 +32,12 @@ importers:
|
|||
'@actions/tool-cache': 1.7.1
|
||||
hasha: 5.2.2
|
||||
semver: 7.3.5
|
||||
which: 2.0.2
|
||||
devDependencies:
|
||||
'@types/jest': 27.0.1
|
||||
'@types/node': 16.9.1
|
||||
'@types/semver': 7.3.8
|
||||
'@types/which': 2.0.1
|
||||
cross-env: 7.0.3
|
||||
eslint-config-atomic: 1.16.2
|
||||
jest: 27.2.0
|
||||
|
@ -1546,6 +1550,10 @@ packages:
|
|||
resolution: {integrity: sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==}
|
||||
dev: true
|
||||
|
||||
/@types/which/2.0.1:
|
||||
resolution: {integrity: sha512-Jjakcv8Roqtio6w1gr0D7y6twbhx6gGgFGF5BLwajPpnOIOxFkakFhCq+LmyyeAz7BX6ULrjBOxdKaCDy+4+dQ==}
|
||||
dev: true
|
||||
|
||||
/@types/yargs-parser/20.2.1:
|
||||
resolution: {integrity: sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==}
|
||||
dev: true
|
||||
|
@ -4799,7 +4807,6 @@ packages:
|
|||
|
||||
/isexe/2.0.0:
|
||||
resolution: {integrity: sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=}
|
||||
dev: true
|
||||
|
||||
/isobject/2.1.0:
|
||||
resolution: {integrity: sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=}
|
||||
|
@ -8425,7 +8432,6 @@ packages:
|
|||
hasBin: true
|
||||
dependencies:
|
||||
isexe: 2.0.0
|
||||
dev: true
|
||||
|
||||
/word-wrap/1.2.3:
|
||||
resolution: {integrity: sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import { exec } from "@actions/exec"
|
||||
import which from "which"
|
||||
|
||||
/** A function that installs a package using pip */
|
||||
export async function setupPip(name: string, version?: string) {
|
||||
// pip3 install conan --upgrade
|
||||
// check if it exists
|
||||
const pip = which.sync("pip3", { nothrow: true }) !== null ? "pip3" : "pip"
|
||||
|
||||
const exit = await exec("pip", ["install", "--user", version !== undefined ? `${name}==${version}` : name])
|
||||
const exit = await exec(pip, ["install", version !== undefined ? `${name}==${version}` : name])
|
||||
if (exit !== 0) {
|
||||
throw new Error(`Failed to install ${name} ${version}`)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue