fix: require python 3.8.0 for cpplint

This commit is contained in:
Amin Yahyaabadi 2024-11-01 02:35:56 -07:00
parent 4d95a50556
commit 255caeb121
6 changed files with 15 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,5 +2,7 @@ import { setupPipPack } from "../utils/setup/setupPipPack.js"
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export function setupCpplint(version: string | undefined, _setupDir: string, _arch: string) { export function setupCpplint(version: string | undefined, _setupDir: string, _arch: string) {
return setupPipPack("cpplint", version) return setupPipPack("cpplint", version, {
pythonVersion: ">=3.8.0",
})
} }

View File

@ -30,6 +30,8 @@ export type SetupPipPackOptions = {
upgrade?: boolean upgrade?: boolean
/** Whether the package is a library */ /** Whether the package is a library */
isLibrary?: boolean isLibrary?: boolean
/** python version (e.g. >=3.8.0) */
pythonVersion?: string
} }
/** A function that installs a package using pip */ /** A function that installs a package using pip */
@ -38,7 +40,7 @@ export async function setupPipPack(
version?: string, version?: string,
options: SetupPipPackOptions = {}, options: SetupPipPackOptions = {},
): Promise<InstallationInfo> { ): Promise<InstallationInfo> {
return setupPipPackWithPython(await getPython(), name, version, options) return setupPipPackWithPython(await getPython(options.pythonVersion), name, version, options)
} }
export async function setupPipPackWithPython( export async function setupPipPackWithPython(
@ -173,12 +175,15 @@ const getPipxBinDir = memoize(getPipxBinDir_, { promise: true })
/* eslint-disable require-atomic-updates */ /* eslint-disable require-atomic-updates */
let pythonBin: string | undefined let pythonBin: string | undefined
async function getPython(): Promise<string> { async function getPython(givenPythonVersion?: string): Promise<string> {
if (pythonBin !== undefined) { if (pythonBin !== undefined) {
return pythonBin return pythonBin
} }
pythonBin = (await setupPython(getVersion("python", undefined, await ubuntuVersion()), "", process.arch)).bin const pythonVersion = givenPythonVersion
?? getVersion("python", undefined, await ubuntuVersion())
pythonBin = (await setupPython(pythonVersion, "", process.arch)).bin
return pythonBin return pythonBin
} }