Skip to content

Commit 502028f

Browse files
committed
Python: absolute basics
probably still need to route some values around
1 parent 9d1e406 commit 502028f

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/feature-flags.ts

Lines changed: 7 additions & 0 deletions
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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import {
6565
getErrorMessage,
6666
} from "./util";
6767
import { validateWorkflow } from "./workflow";
68+
import { isFeatureAvailable } from "@actions/cache";
6869

6970
/** Fields of the init status report that can be sent before `config` is populated. */
7071
interface InitStatusReport extends StatusReportBase {
@@ -611,6 +612,15 @@ async function run() {
611612
);
612613
}
613614

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

src/tools-features.ts

Lines changed: 1 addition & 0 deletions
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)