feat: resolve relative GAUGE_PYTHON_COMMAND against project root - #486
Open
JakubStyczen wants to merge 1 commit into
Open
JakubStyczen wants to merge 1 commit into
JakubStyczen wants to merge 1 commit into
Conversation
Resolve relative paths in GAUGE_PYTHON_COMMAND against GAUGE_PROJECT_ROOT, consistent with how STEP_IMPL_DIR is already resolved in util.py. This enables setting GAUGE_PYTHON_COMMAND to paths like .venv/bin/python or .venv\Scripts\python in python.properties without requiring an absolute path. Fixes getgauge#485 Signed-off-by: Jakub Styczen <styczen37@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When using a virtual environment in a Gauge project, GAUGE_PYTHON_COMMAND only accepts absolute paths or bare command names. Setting it to a relative path like .venv/bin/python fails because the plugin runs from its install directory (~/.gauge/plugins/python/x.y.z/), not from the project root.
This is inconsistent with STEP_IMPL_DIR, which already resolves relative paths against GAUGE_PROJECT_ROOT in util.py.
Solution
Resolve relative GAUGE_PYTHON_COMMAND paths against GAUGE_PROJECT_ROOT in start.sh and start.bat, using the same approach as STEP_IMPL_DIR.
A path is considered relative when it contains a path separator but is not absolute, e.g. for Windows:
D:\Repos\gauge-tests-repo\.venv\Scripts\python.exe
D:/Repos/gauge-tests-repo/.venv/Scripts/python.exe
.\.venv\Scripts\python.exe
.venv\Scripts\python.exe
./.venv/Scripts/python.exe
.venv/Scripts/python.exe
python
Changes
start.sh — case block: skip absolute (/), resolve relative (/*), pass-through bare commands,
start.bat — guard clauses: skip if no GAUGE_PROJECT_ROOT, skip absolute (: at pos 1), skip bare commands (no separators after stripping \ and /).
Testing
All 165 existing unit tests pass (python build.py --test)
Manually verified with a Gauge project using .venv on Windows
Fixes #485