#!/usr/bin/env bash set -euo pipefail repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" uv_bin="${repo_root}/environment/bin/uv" converter_root="${repo_root}/environment/converters/tf2onnx" converter_venv="${converter_root}/.venv" cache_dir="${repo_root}/environment/cache" cd "${repo_root}" if [[ ! -x "${uv_bin}" ]]; then printf 'missing pinned uv executable: %s\n' "${uv_bin}" >&2 exit 2 fi mkdir -p "${converter_root}" if [[ ! -x "${converter_venv}/bin/python" ]]; then "${uv_bin}" venv "${converter_venv}" --python 3.12.13 --seed --cache-dir "${cache_dir}" fi "${uv_bin}" pip install \ --python "${converter_venv}/bin/python" \ --cache-dir "${cache_dir}" \ --requirements "${converter_root}/requirements.lock" "${uv_bin}" pip freeze --python "${converter_venv}/bin/python" \ | LC_ALL=C sort > "${converter_root}/installed-packages.txt" sha256sum "${converter_root}/installed-packages.txt" > "${converter_root}/installed-packages.sha256" "${converter_venv}/bin/python" - <<'PY' import json import platform from pathlib import Path import flatbuffers import numpy import onnx import requests import tf2onnx import tensorflow as tf from google.protobuf import __version__ as protobuf_version root = Path.cwd() / "environment" / "converters" / "tf2onnx" report = { "python": platform.python_version(), "tf2onnx": tf2onnx.__version__, "tensorflow": tf.__version__, "onnx": onnx.__version__, "numpy": numpy.__version__, "protobuf": protobuf_version, "flatbuffers": flatbuffers.__version__, "requests": requests.__version__, } (root / "tool_versions.json").write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8") print(json.dumps(report, sort_keys=True)) PY sha256sum "${converter_root}/tool_versions.json" > "${converter_root}/tool_versions.sha256"