Skip to content

Commit

Permalink
fix: require python 3.8.0 for cpplint
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Nov 1, 2024
1 parent 4d95a50 commit 255caeb
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/legacy/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/legacy/setup-cpp.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/modern/setup-cpp.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/modern/setup-cpp.mjs.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/cpplint/cpplint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ import { setupPipPack } from "../utils/setup/setupPipPack.js"

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function setupCpplint(version: string | undefined, _setupDir: string, _arch: string) {
return setupPipPack("cpplint", version)
return setupPipPack("cpplint", version, {
pythonVersion: ">=3.8.0",
})
}
11 changes: 8 additions & 3 deletions src/utils/setup/setupPipPack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export type SetupPipPackOptions = {
upgrade?: boolean
/** Whether the package is a library */
isLibrary?: boolean
/** python version (e.g. >=3.8.0) */
pythonVersion?: string
}

/** A function that installs a package using pip */
Expand All @@ -38,7 +40,7 @@ export async function setupPipPack(
version?: string,
options: SetupPipPackOptions = {},
): Promise<InstallationInfo> {
return setupPipPackWithPython(await getPython(), name, version, options)
return setupPipPackWithPython(await getPython(options.pythonVersion), name, version, options)
}

export async function setupPipPackWithPython(
Expand Down Expand Up @@ -173,12 +175,15 @@ const getPipxBinDir = memoize(getPipxBinDir_, { promise: true })
/* eslint-disable require-atomic-updates */
let pythonBin: string | undefined

async function getPython(): Promise<string> {
async function getPython(givenPythonVersion?: string): Promise<string> {
if (pythonBin !== undefined) {
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
}

Expand Down

0 comments on commit 255caeb

Please sign in to comment.