CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
48 lines
1.2 KiB
Bash
Executable File
48 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eu
|
|
|
|
readonly requirements_file=$1
|
|
shift
|
|
|
|
venv_dir="$(dirname "$requirements_file")"/.venv
|
|
readonly venv_dir
|
|
readonly venv_req=$venv_dir/requirements.txt
|
|
readonly venv_python_version=$venv_dir/python-version.txt
|
|
|
|
if [ -d "$venv_dir" ]
|
|
then
|
|
if [ ! -r "$venv_python_version" ]
|
|
then
|
|
echo "Python environment predates Python version checks."
|
|
echo "It might be invalid and needs to be regenerated."
|
|
rm -rf "$venv_dir"
|
|
elif ! cmp --quiet <(python3 --version) "$venv_python_version"
|
|
then
|
|
old=$(cat "$venv_python_version")
|
|
new=$(python3 --version)
|
|
echo "Python version has changed ($old -> $new)."
|
|
echo "Python environment needs to be regenerated."
|
|
unset old new
|
|
rm -rf "$venv_dir"
|
|
fi
|
|
fi
|
|
|
|
if ! [ -r "$venv_dir/bin/activate" ]
|
|
then
|
|
echo "Creating Python environment..."
|
|
python3 -m venv "$venv_dir"
|
|
python3 --version > "$venv_python_version"
|
|
fi
|
|
|
|
# shellcheck disable=1091
|
|
source "$venv_dir/bin/activate"
|
|
|
|
if ! cmp --quiet "$requirements_file" "$venv_req"
|
|
then
|
|
echo "$(realpath --relative-to="$PWD" "$requirements_file") has changed, re-installing..."
|
|
pip --disable-pip-version-check install --requirement "$requirements_file"
|
|
cp "$requirements_file" "$venv_req"
|
|
fi
|
|
|
|
python3 "$@"
|