Skip to content

Commit cefca0b

Browse files
committed
fix: update the alternatives only on ubuntu
1 parent 85e2f07 commit cefca0b

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/gcc/gcc.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { addBinExtension } from "../utils/extension/extension"
1414
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
1515
import { extract7Zip } from "../utils/setup/extract"
1616
import { isArch } from "../utils/env/isArch"
17+
import { isUbuntu } from "../utils/env/isUbuntu"
1718

1819
interface MingwInfo {
1920
releaseName: string
@@ -159,7 +160,7 @@ async function activateGcc(version: string, binDir: string) {
159160
if (majorVersion >= 5) {
160161
promises.push(addEnv("CC", `${binDir}/gcc-${majorVersion}`), addEnv("CXX", `${binDir}/g++-${majorVersion}`))
161162

162-
if (process.platform === "linux") {
163+
if (isUbuntu()) {
163164
updateAptAlternatives("cc", `${binDir}/gcc-${majorVersion}`)
164165
updateAptAlternatives("cxx", `${binDir}/g++-${majorVersion}`)
165166
updateAptAlternatives("gcc", `${binDir}/gcc-${majorVersion}`)
@@ -168,7 +169,7 @@ async function activateGcc(version: string, binDir: string) {
168169
} else {
169170
promises.push(addEnv("CC", `${binDir}/gcc-${version}`), addEnv("CXX", `${binDir}/g++-${version}`))
170171

171-
if (process.platform === "linux") {
172+
if (isUbuntu()) {
172173
updateAptAlternatives("cc", `${binDir}/gcc-${version}`)
173174
updateAptAlternatives("cxx", `${binDir}/g++-${version}`)
174175
updateAptAlternatives("gcc", `${binDir}/gcc-${version}`)

src/llvm/llvm.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { isGitHubCI } from "../utils/env/isci"
2121
import { setupGcc } from "../gcc/gcc"
2222
import { getVersion } from "../default_versions"
2323
import { isArch } from "../utils/env/isArch"
24+
import { isUbuntu } from "../utils/env/isUbuntu"
2425

2526
//================================================
2627
// Version
@@ -339,7 +340,7 @@ export async function activateLLVM(directory: string, versionGiven: string) {
339340
}
340341
}
341342

342-
if (process.platform === "linux") {
343+
if (isUbuntu()) {
343344
updateAptAlternatives("cc", `${directory}/bin/clang`)
344345
updateAptAlternatives("cxx", `${directory}/bin/clang++`)
345346
updateAptAlternatives("clang", `${directory}/bin/clang`)

0 commit comments

Comments
 (0)