Skip to content

feat: resolve relative GAUGE_PYTHON_COMMAND against project root - #486

Open
JakubStyczen wants to merge 1 commit into
getgauge:masterfrom
JakubStyczen:feat/relative-gauge-python-command
Open

JakubStyczen wants to merge 1 commit into
getgauge:masterfrom
JakubStyczen:feat/relative-gauge-python-command

Conversation

@JakubStyczen

Copy link
Copy Markdown

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

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

GAUGE_PYTHON_COMMAND does not support relative paths (e.g. .venv/bin/python)

1 participant