Skip to content

Commit e91efaa

Browse files
committed
python: do not extract stdlib by default
1 parent ac8b973 commit e91efaa

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

python/extractor/cli-integration-test/extract-stdlib/test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ rm -rf dbs
1313

1414
mkdir dbs
1515

16-
CODEQL_EXTRACTOR_PYTHON_DONT_EXTRACT_STDLIB=True $CODEQL database create dbs/without-stdlib --language python --source-root repo_dir/
16+
$CODEQL database create dbs/without-stdlib --language python --source-root repo_dir/
1717
$CODEQL query run --database dbs/without-stdlib query.ql > query.without-stdlib.actual
1818
diff query.without-stdlib.expected query.without-stdlib.actual
1919

20-
LGTM_INDEX_EXCLUDE="/usr/lib/**" $CODEQL database create dbs/with-stdlib --language python --source-root repo_dir/
20+
LGTM_INDEX_EXCLUDE="/usr/lib/**" CODEQL_EXTRACTOR_PYTHON_EXTRACT_STDLIB=True $CODEQL database create dbs/with-stdlib --language python --source-root repo_dir/
2121
$CODEQL query run --database dbs/with-stdlib query.ql > query.with-stdlib.actual
2222
diff query.with-stdlib.expected query.with-stdlib.actual

python/extractor/semmle/cmdline.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ def make_parser():
102102
config_options.add_option("--colorize", dest="colorize", default=False, action="store_true",
103103
help = """Colorize the logging output.""")
104104

105-
config_options.add_option("--dont-extract-stdlib", dest="extract_stdlib", default=True, action="store_false",
106-
help="Do not extract the standard library.")
105+
config_options.add_option("--dont-extract-stdlib", dest="extract_stdlib", action="store_false",
106+
help="This flag is deprecated; not extracting the standard library is now the default.")
107+
config_options.add_option("--extract-stdlib", dest="extract_stdlib", default=False, action="store_true",
108+
help="Extract the standard library.")
107109

108110
parser.add_option_group(config_options)
109111

@@ -226,8 +228,16 @@ def parse(command_line):
226228

227229
if 'CODEQL_EXTRACTOR_PYTHON_DONT_EXTRACT_STDLIB' in os.environ:
228230
options.extract_stdlib = False
231+
print ("Warning: CODEQL_EXTRACTOR_PYTHON_DONT_EXTRACT_STDLIB is deprecated; the default is now to not extract the standard library.")
232+
233+
if 'CODEQL_EXTRACTOR_PYTHON_EXTRACT_STDLIB' in os.environ:
234+
options.extract_stdlib = True
229235

230236
options.prune = True
237+
238+
if options.extract_stdlib:
239+
print ("Warning: The analysis will extract the standard library. This behavior is deprecated and will be removed in a future release. We expect it to be gone in CLI version 2.20.0.")
240+
231241
return options, args
232242

233243
def split_and_flatten(options_list, div):

0 commit comments

Comments
 (0)