build: Add Python virtual environment guard to Build.sh#9820
build: Add Python virtual environment guard to Build.sh#9820Divinesoumyadip wants to merge 2 commits intoThe-OpenROAD-Project:masterfrom
Conversation
Signed-off-by: Divinesoumyadip <soumyacode7@gmail.com>
|
clang-tidy review says "All clean, LGTM! 👍" |
There was a problem hiding this comment.
Code Review
This pull request introduces a helpful safety check to Build.sh that warns users when they are not in a Python virtual environment. This is a great improvement for preventing environment-related issues, especially for new contributors. The implementation is straightforward. I've added a couple of suggestions to improve the script's robustness: one to ensure tput is available before use, and another to restore the POSIX-compliant trailing newline at the end of the file.
etc/Build.sh
Outdated
| # ============================================================================== | ||
| # PYTHON VIRTUAL ENVIRONMENT CHECK | ||
| # ============================================================================== | ||
| if [[ -t 1 ]]; then |
There was a problem hiding this comment.
| fi | ||
| eval cmake "${cmakeOptions}" -B "${buildDir}" . | ||
| eval time cmake --build "${buildDir}" -j "${numThreads}" | ||
| eval time cmake --build "${buildDir}" -j "${numThreads}" No newline at end of file |
|
What external packages are being updated during Build.sh? |
Adds a check for tput availability to prevent stderr noise and ensures the file ends with a POSIX-compliant newline. Signed-off-by: Divinesoumyadip <soumyacode7@gmail.com>
|
clang-tidy review says "All clean, LGTM! 👍" |
Hi @maliberty, that is a fair point. |
|
Could you give an example of such a problem report? Is |
Adds a safety check to
Build.shto detect if the user is operating inside a Python Virtual Environment .OpenROAD relies heavily on Python bindings and external PIP packages. On modern Linux distributions (like Ubuntu 24.04 with PEP-668), attempting to install dependencies globally can break OS-level package managers. Beginners frequently fall into this trap, resulting in corrupted local environments and support tickets.
The script now checks for a registered virtual environment. If none is found, it issues a highly visible warning with exact instructions on how to create one (
python3 -m venv or_env), pauses for 3 seconds to ensure the user reads it, and then proceeds.Directly supports the Onboarding Simplification initiative by preemptively stopping developers from destroying their local Python environments during the initial build phase.