Repository navigation
feat(ebuild): fix installation script when using venv - #164
Conversation
c60184c to
21546b0
Compare
The installation script failed with no helpful message when a virtual environment was used. Plus, there were style errors (whitespaces) detected by ruff, that were also fixed. Signed-off-by: Benjamín Guzmán <code@bguzman.dev>
21546b0 to
af7e82c
Compare
|
CI is failing due to an issue after a merge documented here #141 (review) |
…TUAL_ENV candidate Inside a venv, ~/.local/bin/pip3 was picked first, so the package was installed outside the venv. With VIRTUAL_ENV unset, the new candidate expanded to /bin/ebuild.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
srpatcha
left a comment
There was a problem hiding this comment.
Verdict: READY-TO-MERGE
Why CI failed: the run on af7e82c failed at mypy, not in this PR's code:
tests/unit/cli/test_commands_utils.py:5: Module "ebuild.cli.commands" has no attribute "_resolve_runner_args".
The PR was tested against base 7f1ff93, where the 09-30 batch merge had dropped _resolve_runner_args. It was restored on master in aee2231, so merging master fixes it.
Pushed:
- 5164a49: merge origin/master (clean).
- 5c6dada: two fixes in install.sh.
- Use
$VIRTUAL_ENV/bin/pipwhen a venv is active. Before,~/.local/bin/pip3won, so the package was installed outside the venv. - Check
$VIRTUAL_ENV/bin/ebuildfirst, and skip it whenVIRTUAL_ENVis unset. Before, it expanded to/bin/ebuild.
- Use
Verified locally (Python 3.12, WSL):
pytest tests --no-cov: 826 passed, 2 skipped.ruff check .clean.yamllint .rc=0. mypy: no issues in 120 files.bash -n install.shOK.- Ran install.sh in a throwaway venv with an isolated HOME: rc=0, binary resolved to
$VENV/bin/ebuild,ebuild, version 3.0.1. - With a broken pyproject: rc=1 and the "run it manually" hint.
- GitHub CI on 5c6dada: 29 checks pass, including CI Gate.
Not verified: macOS. shellcheck was not available.
The installation script failed with no helpful message when a virtual environment was used.
Summary
This PR improves the
install.shscript to gracefully handle environment-related installation failures. It prevents the script from failing silently when it hits PEP 668 externally-managed-environment protections, and fixes the issue where the installed binary couldn't be located when installed within a local virtual environment.Type of Change
Changes
Updated the pip install step to check for failure instead of failing silently, printing an actionable error message that tells the user how to run the command manually to see the underlying error.
Added
$VIRTUAL_ENV/bin/ebuildto the search paths so the script can locate the binary when installed inside a local virtual environment.Added a warning message when a venv binary is found, notifying the user that its execution will depend on the virtual environment's existence.
Testing
ctest --test-dir build --output-on-failure)Pre-Submission Checklist
-Wall -Wextra -Werrorfor C)<type>(<scope>): <description>conventionmasterRelated Issue
Fixes #163
Screenshots / Logs
Additional Notes