fix: use system python installation on non-ci

This commit is contained in:
Amin Yahyaabadi 2021-09-18 07:50:31 -05:00
parent 7e5fac5146
commit d7f2e680b4
4 changed files with 9 additions and 5 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -67,7 +67,7 @@ const inputs: Array<Inputs> = ["compiler", "architecture", ...tools]
/** The main entry function */ /** The main entry function */
export async function main(args: string[]): Promise<number> { export async function main(args: string[]): Promise<number> {
const isCI = Boolean(process.env.CI) const isCI = process.env.CI === undefined || process.env.CI === "" || process.env.CI === "false"
if (!isCI) { if (!isCI) {
process.env.ACTIONS_ALLOW_UNSECURE_COMMANDS = "true" process.env.ACTIONS_ALLOW_UNSECURE_COMMANDS = "true"

View File

@ -14,6 +14,10 @@ function isPyPyVersion(versionSpec: string) {
} }
export async function setupPython(version: string, setupCppDir: string, arch: string) { export async function setupPython(version: string, setupCppDir: string, arch: string) {
if (process.env.CI === undefined || process.env.CI === "" || process.env.CI === "false") {
return setupPythonViaSystem(version, setupCppDir, arch)
}
try { try {
if (isPyPyVersion(version)) { if (isPyPyVersion(version)) {
const installed = await finderPyPy.findPyPyVersion(version, arch) const installed = await finderPyPy.findPyPyVersion(version, arch)
@ -28,11 +32,11 @@ export async function setupPython(version: string, setupCppDir: string, arch: st
core.info(`##[add-matcher]${path.join(matchersPath, "python.json")}`) core.info(`##[add-matcher]${path.join(matchersPath, "python.json")}`)
return undefined return undefined
} catch (err) { } catch (err) {
return setupPythonFallback(version, setupCppDir, arch) return setupPythonViaSystem(version, setupCppDir, arch)
} }
} }
export async function setupPythonFallback(version: string, setupCppDir: string, arch: string) { export async function setupPythonViaSystem(version: string, setupCppDir: string, arch: string) {
switch (process.platform) { switch (process.platform) {
case "win32": { case "win32": {
// Get an unique output directory name from the URL. // Get an unique output directory name from the URL.