@@ -17,63 +17,33 @@ mkdir dbs
17
17
# set up venvs
18
18
cd repo_dir
19
19
20
+ # make venv with some package in it (so we show that our ignore logic is correct)
20
21
python3 -m venv venv
21
22
venv/bin/pip install flask
22
23
23
- python3 -m venv venv2
24
-
25
24
cd " $SCRIPTDIR "
26
25
27
- # In 2.16.0 we stop extracting libraries by default, so to test this functionality we
28
- # need to force enable it. Once we release 2.17.0 and turn off library extraction for
29
- # good, we can remove the part of this test ensuring that dependencies in an active
30
- # venv are still extracted (since that will no longer be the case).
31
- export CODEQL_EXTRACTOR_PYTHON_FORCE_ENABLE_LIBRARY_EXTRACTION_UNTIL_2_17_0=1
32
-
33
- # Create DBs with venv2 active (that does not have flask installed)
34
- source repo_dir/venv2/bin/activate
35
-
36
26
export CODEQL_EXTRACTOR_PYTHON_DISABLE_AUTOMATIC_VENV_EXCLUDE=
37
27
$CODEQL database create dbs/normal --language python --source-root repo_dir/
38
28
39
29
export CODEQL_EXTRACTOR_PYTHON_DISABLE_AUTOMATIC_VENV_EXCLUDE=1
40
30
$CODEQL database create dbs/no-venv-ignore --language python --source-root repo_dir/
41
31
42
- # Create DB with venv active that has flask installed. We want to ensure that we're
43
- # still able to resolve imports to flask, but don't want to extract EVERYTHING from
44
- # within the venv. Important note is that the test-file in the repo_dir actually imports
45
- # flask :D
46
- source repo_dir/venv/bin/activate
47
- export CODEQL_EXTRACTOR_PYTHON_DISABLE_AUTOMATIC_VENV_EXCLUDE=
48
- $CODEQL database create dbs/normal-with-flask-venv --language python --source-root repo_dir/
49
-
50
32
# ---
51
33
52
34
set +x
53
35
54
36
EXTRACTED_NORMAL=$( unzip -l dbs/normal/src.zip | wc -l)
55
37
EXTRACTED_NO_VENV_IGNORE=$( unzip -l dbs/no-venv-ignore/src.zip | wc -l)
56
- EXTRACTED_ACTIVE_FLASK=$( unzip -l dbs/normal-with-flask-venv/src.zip | wc -l)
57
38
58
39
exitcode=0
59
40
60
41
echo " EXTRACTED_NORMAL=$EXTRACTED_NORMAL "
61
42
echo " EXTRACTED_NO_VENV_IGNORE=$EXTRACTED_NO_VENV_IGNORE "
62
- echo " EXTRACTED_ACTIVE_FLASK=$EXTRACTED_ACTIVE_FLASK "
63
43
64
44
if [[ ! $EXTRACTED_NORMAL -lt $EXTRACTED_NO_VENV_IGNORE ]]; then
65
45
echo " ERROR: EXTRACTED_NORMAL not smaller EXTRACTED_NO_VENV_IGNORE"
66
46
exitcode=1
67
47
fi
68
48
69
- if [[ ! $EXTRACTED_NORMAL -lt $EXTRACTED_ACTIVE_FLASK ]]; then
70
- echo " ERROR: EXTRACTED_NORMAL not smaller EXTRACTED_ACTIVE_FLASK"
71
- exitcode=1
72
- fi
73
-
74
- if [[ ! $EXTRACTED_ACTIVE_FLASK -lt $EXTRACTED_NO_VENV_IGNORE ]]; then
75
- echo " ERROR: EXTRACTED_ACTIVE_FLASK not smaller EXTRACTED_NO_VENV_IGNORE"
76
- exitcode=1
77
- fi
78
-
79
49
exit $exitcode
0 commit comments