fix: fix python, pip, and doxygen on fedora

This commit is contained in:
Amin Yahyaabadi 2022-07-10 17:53:17 -07:00
parent 1103890904
commit 4a49195853
7 changed files with 25 additions and 20 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

@ -14,6 +14,7 @@ import { join } from "path"
import { isArch } from "../utils/env/isArch" import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf" import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack" import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"
/** Get the platform data for cmake */ /** Get the platform data for cmake */
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -60,27 +61,27 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
} }
case "linux": { case "linux": {
let installationInfo: InstallationInfo let installationInfo: InstallationInfo
if (version === "") { if (version === "" || isArch() || hasDnf()) {
if (isArch()) { if (isArch()) {
installationInfo = setupPacmanPack("doxygen", undefined) installationInfo = setupPacmanPack("doxygen", version)
} else if (hasDnf()) { } else if (hasDnf()) {
return setupDnfPack("doxygen", version) return setupDnfPack("doxygen", version)
} else if (isUbuntu()) {
installationInfo = setupAptPack("doxygen", version)
} else { } else {
throw new Error(`Unsupported linux distributions`)
}
} else if (isUbuntu()) {
try {
// doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
installationInfo = await setupBin("doxygen", version, getDoxygenPackageInfo, setupDir, arch)
setupAptPack("libclang-cpp9")
} catch (err) {
notice(`Failed to download doxygen binary. ${err}. Falling back to apt-get.`)
installationInfo = setupAptPack("doxygen", undefined) installationInfo = setupAptPack("doxygen", undefined)
} }
} else { } else {
if (isArch()) { throw new Error(`Unsupported linux distributions`)
installationInfo = setupPacmanPack("doxygen", version)
} else {
try {
// doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
installationInfo = await setupBin("doxygen", version, getDoxygenPackageInfo, setupDir, arch)
setupAptPack("libclang-cpp9")
} catch (err) {
notice(`Failed to download doxygen binary. ${err}. Falling back to apt-get.`)
installationInfo = setupAptPack("doxygen", undefined)
}
}
} }
await setupGraphviz(getVersion("graphviz", undefined), "", arch) await setupGraphviz(getVersion("graphviz", undefined), "", arch)
return installationInfo return installationInfo

View File

@ -11,6 +11,7 @@ import { InstallationInfo } from "../utils/setup/setupBin"
import { dirname, join } from "path" import { dirname, join } from "path"
import { hasDnf } from "../utils/env/hasDnf" import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack" import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"
export async function setupPython(version: string, setupDir: string, arch: string) { export async function setupPython(version: string, setupDir: string, arch: string) {
if (!isGitHubCI()) { if (!isGitHubCI()) {
@ -60,9 +61,11 @@ export async function setupPythonViaSystem(
setupPacmanPack("python-pip") setupPacmanPack("python-pip")
} else if (hasDnf()) { } else if (hasDnf()) {
installInfo = setupDnfPack("python3", version) installInfo = setupDnfPack("python3", version)
} else { } else if (isUbuntu()) {
installInfo = setupAptPack("python3", version) installInfo = setupAptPack("python3", version)
setupAptPack("python3-pip") setupAptPack("python3-pip")
} else {
throw new Error(`Unsupported linux distributions`)
} }
return installInfo return installInfo
} }

View File

@ -12,6 +12,7 @@ import { InstallationInfo } from "./setupBin"
import { setupAptPack } from "./setupAptPack" import { setupAptPack } from "./setupAptPack"
import { setupPacmanPack } from "./setupPacmanPack" import { setupPacmanPack } from "./setupPacmanPack"
import { isArch } from "../env/isArch" import { isArch } from "../env/isArch"
import { isUbuntu } from "../env/isUbuntu"
let python: string | undefined let python: string | undefined
let binDir: string | undefined let binDir: string | undefined
@ -46,7 +47,7 @@ export async function setupPipPack(name: string, version?: string): Promise<Inst
// ensure that pip is installed on Linux (happens when python is found but pip not installed) // ensure that pip is installed on Linux (happens when python is found but pip not installed)
if (isArch()) { if (isArch()) {
setupPacmanPack("python-pip") setupPacmanPack("python-pip")
} else { } else if (isUbuntu()) {
setupAptPack("python3-pip") setupAptPack("python3-pip")
} }
} }