chore: Make license script used in build more portable #4861
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.
The current script
cliv2/ scripts/prepare_licenses.sh
assumes it can run python directly on the host. If someone is using python actively for development that's likely disabled. It's good practice to disable pip from installing in the global namespace using one of:That means when running a build it will fail like so:
This PR changes the script to use
virtualenv
if it's installed. It will create a venv if needed, or reuse an existing one. If virtualenv is not installed it will fall back on the current behaviour.What does this PR do?
Makes the build process more portable, by using virtualenv when present to avoid clashes with the system python configuration.
Where should the reviewer start?
By running the script directly, followed by running a full build.
How should this be manually tested?