Skip to content

Commit

Permalink
python: do not extract stdlib by default
Browse files Browse the repository at this point in the history
  • Loading branch information
yoff committed Jun 26, 2024
1 parent 571be8b commit 88fd98e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions python/extractor/cli-integration-test/extract-stdlib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ rm -rf dbs

mkdir dbs

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

LGTM_INDEX_EXCLUDE="/usr/lib/**" $CODEQL database create dbs/with-stdlib --language python --source-root repo_dir/
LGTM_INDEX_EXCLUDE="/usr/lib/**" CODEQL_EXTRACTOR_PYTHON_EXTRACT_STDLIB=True $CODEQL database create dbs/with-stdlib --language python --source-root repo_dir/
$CODEQL query run --database dbs/with-stdlib query.ql > query.with-stdlib.actual
diff query.with-stdlib.expected query.with-stdlib.actual
8 changes: 4 additions & 4 deletions python/extractor/semmle/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def make_parser():
config_options.add_option("--colorize", dest="colorize", default=False, action="store_true",
help = """Colorize the logging output.""")

config_options.add_option("--dont-extract-stdlib", dest="extract_stdlib", default=True, action="store_false",
help="Do not extract the standard library.")
config_options.add_option("--extract-stdlib", dest="extract_stdlib", default=False, action="store_true",
help="Extract the standard library.")

parser.add_option_group(config_options)

Expand Down Expand Up @@ -224,8 +224,8 @@ def parse(command_line):
max_import_depth = float('inf')
options.max_import_depth = max_import_depth

if 'CODEQL_EXTRACTOR_PYTHON_DONT_EXTRACT_STDLIB' in os.environ:
options.extract_stdlib = False
if 'CODEQL_EXTRACTOR_PYTHON_EXTRACT_STDLIB' in os.environ:
options.extract_stdlib = True

options.prune = True
return options, args
Expand Down

0 comments on commit 88fd98e

Please sign in to comment.