Skip to content

Commit 3e07412

Browse files
committed
Fix venv check by inverting exit code and adding more info
1 parent b5c959f commit 3e07412

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

.github/workflows/internal-check-python-venv-support.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,17 @@ jobs:
3232
env:
3333
USE_VIRTUAL_PYTHON_ENVIRONMENT_VENV: "true"
3434
# 1. Run the script under test to create, activate and install the virtual environment
35-
# 2a. Run pip in dry-run mode without installing or resolving dependencies
36-
# 2b. Suppress all pip output (stderr)
37-
# 2c. Check if pip *would install* anything using grep
38-
# 2d. If there are missing dependencies and the environment is incomplete, return 1 (indicates all requirements already satisfied)
35+
# 2. Run pip install for the current environment in dry-mode with full output first to get all infos and fail on missing packages.
36+
# 3a. The leading exclamation mark tells the shell to invert the returned exit code.
37+
# Failing because "Would install" is missing leads to a successful execution.
38+
# 3b. Run pip install for the current environment in dry-run mode without installing or resolving dependencies
39+
# 3c. Suppress all pip output (stderr)
40+
# 3d. Check if pip would install anything using grep
41+
# 3e. If there are missing dependencies and the environment is incomplete,
42+
# fail with code 1 (indicates all requirements already satisfied)
43+
#
44+
# Output installed dependencies for troubleshooting purposes:.venv/bin/pip freeze
3945
run: |
40-
./scripts/activatePythonEnvironment.sh
41-
pip install --dry-run --no-deps --requirement "./requirements.txt" 2>/dev/null | grep -q "Would install" || return 1
46+
source ./scripts/activatePythonEnvironment.sh
47+
.venv/bin/pip install --dry-run --quiet --requirement requirements.txt
48+
! .venv/bin/pip install --dry-run --requirement requirements.txt 2>/dev/null | grep -q "Would install"

0 commit comments

Comments
 (0)