File tree Expand file tree Collapse file tree 4 files changed +49
-123
lines changed Expand file tree Collapse file tree 4 files changed +49
-123
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -Eeuo pipefail # see https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
4
+
5
+ set -x
6
+
7
+ CODEQL=${CODEQL:- codeql}
8
+
9
+ SCRIPTDIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd ) "
10
+ cd " $SCRIPTDIR "
11
+
12
+ # start on clean slate
13
+ rm -rf dbs repo_dir/venv*
14
+ mkdir dbs
15
+
16
+
17
+ # set up venvs
18
+ cd repo_dir
19
+
20
+ # make venv with some package in it (so we show that our ignore logic is correct)
21
+ python3 -m venv venv
22
+ venv/bin/pip install flask
23
+
24
+ cd " $SCRIPTDIR "
25
+
26
+ export CODEQL_EXTRACTOR_PYTHON_DISABLE_AUTOMATIC_VENV_EXCLUDE=
27
+ $CODEQL database create dbs/normal --language python --source-root repo_dir/
28
+
29
+ export CODEQL_EXTRACTOR_PYTHON_DISABLE_AUTOMATIC_VENV_EXCLUDE=1
30
+ $CODEQL database create dbs/no-venv-ignore --language python --source-root repo_dir/
31
+
32
+ # ---
33
+
34
+ set +x
35
+
36
+ EXTRACTED_NORMAL=$( unzip -l dbs/normal/src.zip | wc -l)
37
+ EXTRACTED_NO_VENV_IGNORE=$( unzip -l dbs/no-venv-ignore/src.zip | wc -l)
38
+
39
+ exitcode=0
40
+
41
+ echo " EXTRACTED_NORMAL=$EXTRACTED_NORMAL "
42
+ echo " EXTRACTED_NO_VENV_IGNORE=$EXTRACTED_NO_VENV_IGNORE "
43
+
44
+ if [[ ! $EXTRACTED_NORMAL -lt $EXTRACTED_NO_VENV_IGNORE ]]; then
45
+ echo " ERROR: EXTRACTED_NORMAL not smaller EXTRACTED_NO_VENV_IGNORE"
46
+ exitcode=1
47
+ fi
48
+
49
+ exit $exitcode
You can’t perform that action at this time.
0 commit comments