Skip to content

Commit 484870e

Browse files
committed
use hashed pip install and brew for mac
Assisted-by: Cursor/Composer-2 Signed-off-by: Aleksandr Motsjonov <soswow@gmail.com>
1 parent 0b81729 commit 484870e

5 files changed

Lines changed: 15 additions & 9 deletions

File tree

.github/workflows/build-steps.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ on:
8888
type: string
8989
build_local_deps:
9090
type: string
91-
# When set (e.g. `both`), CMake builds pybind11 and/or nanobind per OIIO
92-
# docs; dependency scripts install the `nanobind` pip package when needed.
9391
oiio_python_bindings_backend:
9492
type: string
9593
default: ''
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# CI-only: nanobind for CMake (`python -m nanobind --cmake_dir`). Used on Linux
2+
# (gh-installdeps) and Windows (gh-win-installdeps) with pip --require-hashes.
3+
# macOS CI uses `brew install nanobind` instead (install_homebrew_deps.bash).
4+
# When bumping pip pin: https://pypi.org/pypi/nanobind/<ver>/json → wheel sha256.
5+
nanobind==2.12.0 \
6+
--hash=sha256:a10d3d88e691dcdf22696f9acd893fda3c5a05635763aea238829d274fcad480

src/build-scripts/gh-installdeps.bash

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,13 @@ df -h .
231231
df -h /host/root || true
232232

233233
# nanobind's CMake config is discovered via `python -m nanobind --cmake_dir`.
234+
# Version + wheel hash: src/build-scripts/ci-requirements-nanobind.txt (CodeQL / supply chain).
234235
if [[ "${OIIO_PYTHON_BINDINGS_BACKEND:-}" == "both" || "${OIIO_PYTHON_BINDINGS_BACKEND:-}" == "nanobind" ]] ; then
236+
_oiio_nanobind_requirements_file="$PWD/src/build-scripts/ci-requirements-nanobind.txt"
235237
if [[ "$ASWF_ORG" != "" ]] ; then
236-
time pip3 install nanobind || true
238+
time pip3 install -r "$_oiio_nanobind_requirements_file" --require-hashes || true
237239
else
238-
time pip3${PIP_SUFFIX} install nanobind
240+
time pip3${PIP_SUFFIX} install -r "$_oiio_nanobind_requirements_file" --require-hashes
239241
fi
240242
fi
241243

src/build-scripts/gh-win-installdeps.bash

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ fi
4040
pip install numpy
4141

4242
if [[ "${OIIO_PYTHON_BINDINGS_BACKEND:-}" == "both" || "${OIIO_PYTHON_BINDINGS_BACKEND:-}" == "nanobind" ]] ; then
43-
"${Python_EXECUTABLE:-python}" -m pip install nanobind
43+
_oiio_nanobind_requirements_file="$PWD/src/build-scripts/ci-requirements-nanobind.txt"
44+
"${Python_EXECUTABLE:-python}" -m pip install -r "$_oiio_nanobind_requirements_file" --require-hashes
4445
fi
4546

4647

src/build-scripts/install_homebrew_deps.bash

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,16 @@ if [[ "$OIIO_BREW_INSTALL_PACKAGES" == "" ]] ; then
5757
if [[ "${USE_QT:=1}" != "0" ]] && [[ "${INSTALL_QT:=1}" != "0" ]] ; then
5858
OIIO_BREW_INSTALL_PACKAGES+=" qt${QT_VERSION}"
5959
fi
60+
if [[ "${OIIO_PYTHON_BINDINGS_BACKEND:-}" == "both" || "${OIIO_PYTHON_BINDINGS_BACKEND:-}" == "nanobind" ]] ; then
61+
OIIO_BREW_INSTALL_PACKAGES+=" nanobind"
62+
fi
6063
fi
6164
brew install --display-times -q $OIIO_BREW_INSTALL_PACKAGES $OIIO_BREW_EXTRA_INSTALL_PACKAGES || true
6265

6366
echo ""
6467
echo "After brew installs:"
6568
brew list --versions
6669

67-
if [[ "${OIIO_PYTHON_BINDINGS_BACKEND:-}" == "both" || "${OIIO_PYTHON_BINDINGS_BACKEND:-}" == "nanobind" ]] ; then
68-
python3 -m pip install nanobind
69-
fi
70-
7170
# Set up paths. These will only affect the caller if this script is
7271
# run with 'source' rather than in a separate shell.
7372
export PATH=${HOMEBREW_PREFIX}/opt/qt5/bin:$PATH

0 commit comments

Comments
 (0)