+ # We must always add a wheel to our repository, even if we're not building
+ # this distro package, because it might be a dependency for a later
+ # package we do build.
+ if [[ "$PKG_DIR" =~ ^.=[0-9]+\. ]]; then
+ # Not source to build, but a version to download.
+ # The rest of the function expects a filesystem path, so set one afterwards.
+ "$PYTHON_BUILDROOT/venv/bin/pip" download --dest="$PYTHON_BUILDROOT/wheelhouse" "$PKG$PKG_DIR" \
+ && PKG_DIR="$PYTHON_BUILDROOT/nonexistent"
+ else
+ # Make PKG_DIR absolute.
+ PKG_DIR="$(env -C "$WORKSPACE" readlink -e "$PKG_DIR")"
+ if [[ -e "$PKG_DIR/pyproject.toml" ]]; then
+ "$PYTHON_BUILDROOT/venv/bin/python" -m build --outdir="$PYTHON_BUILDROOT/wheelhouse" "$PKG_DIR"
+ else
+ env -C "$PKG_DIR" "$PYTHON_BUILDROOT/venv/bin/python" setup.py bdist_wheel --dist-dir="$PYTHON_BUILDROOT/wheelhouse"
+ fi
+ fi
+ if [[ $? -ne 0 ]]; then
+ printf "Error, unable to download/build wheel for %s @ %s" "$PKG" "$PKG_DIR"
+ exit 1
+ elif ! "$PYTHON_BUILDROOT/venv/bin/piprepo" build "$PYTHON_BUILDROOT/wheelhouse"; then
+ printf "Error, unable to update local wheel repository"
+ exit 1
+ fi