github / github/codeql

Use Specific Python Virtual Environment Dependency

Offen
#14,187 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Python question
Vorherrschende Sprache
CodeQL
Sterne
10.1k
Forks
2.1k
Ø Merge
2 T. 15 Std.
Gemergte PRs (30 T.)
141

Beschreibung

## System
- Codeql version: 2.11.2.
- Ubuntu 20.04
- system wide installation in folder (`/home/user/.local/lib/`): `python3.6`, `python3.8`, `python3.10`.
- local python version (virtual environment): `venv38/lib/python3.8/`

## What

I have a bash script that generates the CodeQL database from a specific folder:
```bash
...
# enter in the python3.8 environment with my libraries installed
source venv38/bin/activate
...
# create the db
codeql database create $dataset_path/codeql \
--language=python \
--overwrite \
--source-root=$dataset_raw_files_path
...
```
Output Log:
```txt
...
[2023-09-12 13:54:00] [build-stdout] [INFO] [2] Extracted file /usr/lib/python3.6/tarfile.py in 2036ms
[2023-09-12 13:54:00] [build-stdout] [INFO] [6] Extracted module _md5 in 13ms
[2023-09-12 13:54:00] [build-stdout] [INFO] [3] Extracted file /home/username/.local/lib/python3.6/site-packages/my_fancy_dependency/folder/dependency_file_version_36.py in 352ms
..
```

## Expectation
I would expect codeql to create the db with the custom path to my virtual environment `venv38/lib/python3.8/site-packages/..` and not the system wide python installation: `.local/lib/python3.6`.

**Question**: How can I achieve that? Is there a specific flag or procedure? I cannot find it in the manual [codeql database create](https://docs.github.com/en/code-security/codeql-cli/codeql-cli-manual/database-create)

## Extra Info
1. I need this because the package I need (e.g., in the example the ficticious `my_fancy_dependency`) has a different version for python3.6 (systemwide python installation) and python3.8.
2. I noted that I have other databases which correctly use the right version of python, but it is unclear how they have been created since I have a similar script to generate them from the same folder.

Let me know if you need more info.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.