@@ -17,63 +17,33 @@ mkdir dbs
1717# set up venvs
1818cd repo_dir
1919
20+ # make venv with some package in it (so we show that our ignore logic is correct)
2021python3 -m venv venv
2122venv/bin/pip install flask
2223
23- python3 -m venv venv2
24-
2524cd " $SCRIPTDIR "
2625
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-
3626export CODEQL_EXTRACTOR_PYTHON_DISABLE_AUTOMATIC_VENV_EXCLUDE=
3727$CODEQL database create dbs/normal --language python --source-root repo_dir/
3828
3929export CODEQL_EXTRACTOR_PYTHON_DISABLE_AUTOMATIC_VENV_EXCLUDE=1
4030$CODEQL database create dbs/no-venv-ignore --language python --source-root repo_dir/
4131
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-
5032# ---
5133
5234set +x
5335
5436EXTRACTED_NORMAL=$( unzip -l dbs/normal/src.zip | wc -l)
5537EXTRACTED_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)
5738
5839exitcode=0
5940
6041echo " EXTRACTED_NORMAL=$EXTRACTED_NORMAL "
6142echo " EXTRACTED_NO_VENV_IGNORE=$EXTRACTED_NO_VENV_IGNORE "
62- echo " EXTRACTED_ACTIVE_FLASK=$EXTRACTED_ACTIVE_FLASK "
6343
6444if [[ ! $EXTRACTED_NORMAL -lt $EXTRACTED_NO_VENV_IGNORE ]]; then
6545 echo " ERROR: EXTRACTED_NORMAL not smaller EXTRACTED_NO_VENV_IGNORE"
6646 exitcode=1
6747fi
6848
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-
7949exit $exitcode
0 commit comments