fix: check isUbuntu before using apt - fixes pip packages

This commit is contained in:
Amin Yahyaabadi 2022-07-10 17:39:21 -07:00
parent 5ca7197035
commit 1103890904
14 changed files with 34 additions and 16 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

2
dist/setup_cpp.mjs 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

@ -5,6 +5,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function setupCcache(version: string, _setupDir: string, _arch: string) {
@ -20,8 +21,10 @@ export function setupCcache(version: string, _setupDir: string, _arch: string) {
return setupPacmanPack("ccache", version)
} else if (hasDnf()) {
return setupDnfPack("ccache", version)
} else if (isUbuntu()) {
return setupAptPack("ccache", version)
}
return setupAptPack("ccache", version)
throw new Error(`Unsupported linux distribution`)
}
default: {
throw new Error(`Unsupported platform`)

View File

@ -6,6 +6,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupCppcheck(version: string | undefined, _setupDir: string, _arch: string) {
@ -23,8 +24,10 @@ export async function setupCppcheck(version: string | undefined, _setupDir: stri
return setupPacmanPack("cppcheck", version)
} else if (hasDnf()) {
return setupDnfPack("ccache", version)
} else if (isUbuntu()) {
return setupAptPack("cppcheck", version)
}
return setupAptPack("cppcheck", version)
throw new Error(`Unsupported linux distribution`)
}
default: {
throw new Error(`Unsupported platform`)

View File

@ -88,7 +88,7 @@ export async function setupGcc(version: string, setupDir: string, arch: string)
installationInfo = setupPacmanPack("gcc", version)
} else if (hasDnf()) {
installationInfo = setupDnfPack("gcc", version)
} else {
} else if (isUbuntu()) {
setupAptPack("gcc", version, ["ppa:ubuntu-toolchain-r/test"])
installationInfo = setupAptPack("g++", version, [])
}
@ -96,7 +96,7 @@ export async function setupGcc(version: string, setupDir: string, arch: string)
info(`Install g++-multilib because gcc for ${arch} was requested`)
if (isArch()) {
setupPacmanPack("gcc-multilib", version)
} else {
} else if (isUbuntu()) {
setupAptPack("gcc-multilib", version, ["ppa:ubuntu-toolchain-r/test"])
}
}

View File

@ -7,6 +7,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupGraphviz(version: string, _setupDir: string, _arch: string) {
@ -23,8 +24,10 @@ export async function setupGraphviz(version: string, _setupDir: string, _arch: s
return setupPacmanPack("graphviz", version)
} else if (hasDnf()) {
return setupDnfPack("graphviz", version)
} else if (isUbuntu()) {
return setupAptPack("graphviz", version)
}
return setupAptPack("graphviz", version)
throw new Error(`Unsupported linux distribution`)
}
default: {
throw new Error(`Unsupported platform`)

View File

@ -13,6 +13,7 @@ import { PackageInfo, setupBin } from "../utils/setup/setupBin"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"
function getKcovPackageInfo(version: string): PackageInfo {
const version_number = parseInt(version.replace(/^v/, ""), 10)
@ -52,7 +53,7 @@ async function buildKcov(file: string, dest: string) {
} else if (hasDnf()) {
setupDnfPack("libdwarf-devel")
setupDnfPack("libcurl-devel")
} else {
} else if (isUbuntu()) {
setupAptPack("libdw-dev")
setupAptPack("libcurl4-openssl-dev")
}
@ -71,7 +72,7 @@ export async function setupKcov(version: string, setupDir: string, arch: string)
setupPacmanPack("binutils")
} else if (hasDnf()) {
setupDnfPack("binutils")
} else {
} else if (isUbuntu()) {
setupAptPack("libbinutils")
}
return installationInfo

View File

@ -290,7 +290,7 @@ async function _setupLLVM(version: string, setupDir: string, arch: string) {
if (isArch()) {
// setupPacmanPack("ncurses")
// TODO: install libtinfo ?
} else {
} else if (isUbuntu()) {
setupAptPack("libtinfo-dev")
}
}

View File

@ -6,6 +6,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupMake(version: string, _setupDir: string, _arch: string) {
@ -23,8 +24,10 @@ export async function setupMake(version: string, _setupDir: string, _arch: strin
return setupPacmanPack("make", version)
} else if (hasDnf()) {
return setupDnfPack("make", version)
} else if (isUbuntu()) {
return setupAptPack("make", version)
}
return setupAptPack("make", version)
throw new Error(`Unsupported linux distribution`)
}
default: {
throw new Error(`Unsupported platform`)

View File

@ -5,6 +5,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function setupSevenZip(version: string, _setupDir: string, _arch: string) {
@ -20,8 +21,10 @@ export function setupSevenZip(version: string, _setupDir: string, _arch: string)
return setupPacmanPack("p7zip", version)
} else if (hasDnf()) {
return setupDnfPack("p7zip", version)
} else if (isUbuntu()) {
return setupAptPack("p7zip-full", version)
}
return setupAptPack("p7zip-full", version)
throw new Error(`Unsupported linux distribution`)
}
default: {
throw new Error(`Unsupported platform`)

View File

@ -10,6 +10,7 @@ import { setupPacmanPack } from "./setupPacmanPack"
import { isArch } from "../env/isArch"
import { hasDnf } from "../env/hasDnf"
import { setupDnfPack } from "./setupDnfPack"
import { isUbuntu } from "../env/isUbuntu"
/** A type that describes a package */
export type PackageInfo = {
@ -100,7 +101,7 @@ export async function setupBin(
setupDnfPack("unzip")
setupDnfPack("tar")
setupDnfPack("xz")
} else {
} else if (isUbuntu()) {
setupAptPack("unzip")
setupAptPack("tar")
setupAptPack("xz-utils")

View File

@ -13,6 +13,7 @@ import { InstallationInfo } from "../utils/setup/setupBin"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"
let hasVCPKG = false
@ -35,7 +36,7 @@ export async function setupVcpkg(_version: string, setupDir: string, _arch: stri
setupDnfPack("tar")
setupDnfPack("git")
setupDnfPack("pkg-config")
} else {
} else if (isUbuntu()) {
setupAptPack("curl")
setupAptPack("zip")
setupAptPack("unzip")