Skip to content

Commit 0c3e006

Browse files
authored
Merge pull request #2536 from yoff/python/ff-std-lib-extraction
Python: Handle new default for standard library extraction
2 parents 38469af + 201e02e commit 0c3e006

9 files changed

+46
-3
lines changed

lib/feature-flags.js

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/feature-flags.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.js

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/tools-features.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/tools-features.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/feature-flags.ts

+7
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export interface FeatureEnablement {
4747
export enum Feature {
4848
ArtifactV4Upgrade = "artifact_v4_upgrade",
4949
CleanupTrapCaches = "cleanup_trap_caches",
50+
CodeqlActionPythonDefaultIsToNotExtractStdlib = "codeql_action_python_default_is_to_not_extract_stdlib",
5051
CppDependencyInstallation = "cpp_dependency_installation_enabled",
5152
DisableCsharpBuildless = "disable_csharp_buildless",
5253
DisableJavaBuildlessEnabled = "disable_java_buildless_enabled",
@@ -97,6 +98,12 @@ export const featureConfig: Record<
9798
envVar: "CODEQL_ACTION_CLEANUP_TRAP_CACHES",
9899
minimumVersion: undefined,
99100
},
101+
[Feature.CodeqlActionPythonDefaultIsToNotExtractStdlib]: {
102+
defaultValue: false,
103+
envVar: "CODEQL_ACTION_DISABLE_PYTHON_STANDARD_LIBRARY_EXTRACTION",
104+
minimumVersion: undefined,
105+
toolsFeature: ToolsFeature.PythonDefaultIsToNotExtractStdlib,
106+
},
100107
[Feature.CppDependencyInstallation]: {
101108
defaultValue: false,
102109
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",

src/init-action.ts

+18
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,24 @@ async function run() {
611611
);
612612
}
613613

614+
if (
615+
await codeql.supportsFeature(
616+
ToolsFeature.PythonDefaultIsToNotExtractStdlib,
617+
)
618+
) {
619+
// We are in the case where the default has switched to not extracting the stdlib.
620+
if (
621+
!(await features.getValue(
622+
Feature.CodeqlActionPythonDefaultIsToNotExtractStdlib,
623+
codeql,
624+
))
625+
) {
626+
// We are in a situation where the feature flag is not rolled out,
627+
// so we need to suppress the new default behavior.
628+
core.exportVariable("CODEQL_EXTRACTOR_PYTHON_EXTRACT_STDLIB", "true");
629+
}
630+
}
631+
614632
const sourceRoot = path.resolve(
615633
getRequiredEnvParam("GITHUB_WORKSPACE"),
616634
getOptionalInput("source-root") || "",

src/tools-features.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export enum ToolsFeature {
1010
TraceCommandUseBuildMode = "traceCommandUseBuildMode",
1111
SarifMergeRunsFromEqualCategory = "sarifMergeRunsFromEqualCategory",
1212
ForceOverwrite = "forceOverwrite",
13+
PythonDefaultIsToNotExtractStdlib = "pythonDefaultIsToNotExtractStdlib",
1314
}
1415

1516
/**

0 commit comments

Comments
 (0)