fix: return installation directory for pip packages

This commit is contained in:
Amin Yahyaabadi 2021-09-16 11:14:08 -05:00
parent 8e56d264af
commit bf63dd58d3
6 changed files with 22 additions and 13 deletions

View File

@ -1,11 +1,12 @@
import { setupConan } from "../conan"
import { testBin } from "../../utils/tests/test-helpers"
import { InstallationInfo } from "../../utils/setup/setupBin"
jest.setTimeout(200000)
describe("setup-conan", () => {
it("should setup conan", async () => {
await setupConan("1.40.1", "", "")
const installInfo = await setupConan("", "", "")
await testBin("conan")
await testBin("conan", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
})
})

View File

@ -1,6 +1,6 @@
import { setupPipPack } from "../utils/setup/setupPipPack"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupConan(version: string | undefined, _setupCppDir: string, _arch: string) {
await setupPipPack("conan", version)
export function setupConan(version: string | undefined, _setupCppDir: string, _arch: string) {
return setupPipPack("conan", version)
}

View File

@ -1,11 +1,11 @@
import { setupGcovr } from "../gcovr"
import { testBin } from "../../utils/tests/test-helpers"
import { InstallationInfo } from "../../utils/setup/setupBin"
jest.setTimeout(200000)
describe("setup-gcovr", () => {
it("should setup gcovr", async () => {
await setupGcovr("5.0", "", "")
await testBin("gcovr")
const installInfo = await setupGcovr("", "", "")
await testBin("gcovr", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
})
})

View File

@ -1,10 +1,12 @@
import { setupMeson } from "../meson"
import { testBin } from "../../utils/tests/test-helpers"
import { InstallationInfo } from "../../utils/setup/setupBin"
jest.setTimeout(200000)
describe("setup-meson", () => {
it("should setup meson", async () => {
await setupMeson("0.59.1", "", "")
await testBin("meson")
const installInfo = await setupMeson("", "", "")
await testBin("meson", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
})
})

View File

@ -1,6 +1,6 @@
import { setupPipPack } from "../utils/setup/setupPipPack"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupMeson(version: string | undefined, _setupCppDir: string, _arch: string) {
await setupPipPack("meson", version)
export function setupMeson(version: string | undefined, _setupCppDir: string, _arch: string) {
return setupPipPack("meson", version)
}

View File

@ -26,12 +26,18 @@ export async function setupPipPack(name: string, version?: string) {
throw new Error(`Failed to install ${name} ${version}`)
}
let binDir: string | undefined
if (process.platform === "linux") {
try {
startGroup(`Add /home/runner/.local/bin to PATH`)
addPath("/home/runner/.local/bin/")
binDir = "/home/runner/.local/bin/"
startGroup(`${binDir} to PATH`)
addPath(binDir)
} finally {
endGroup()
}
} else if (process.platform === "darwin") {
binDir = "/usr/local/bin/"
}
return binDir
}