Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions ci/build-wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ PY_ABI_THREAD=$($PYTHON -c "import sysconfig; print(sysconfig.get_config_var('ab

IS_CONDA=$([ -n "$CONDA_EXE" ] && echo "1")
IS_MINGW=$([[ $PY_PLATFORM == mingw* ]] && echo "1")
IS_WINDOWS=$([[ $PY_PLATFORM == win* ]] && echo "1")

PYTHON_TAG=cp$PY_VERSION_NODOT
if [ "$IS_CONDA" == "1" ]; then
Expand Down Expand Up @@ -142,6 +143,9 @@ _build_wheel () {
# Do not export UV_SYSTEM_PYTHON to avoid conflict with uv in
# cibuildwheel on macOS and Windows
unset UV_SYSTEM_PYTHON
if [ "$CI" == "true" ] && [ "$IS_WINDOWS" == "1" ]; then
export UV_LINK_MODE=copy
fi
if [ -e "$HOME/bin/cibuildwheel" ]; then
"$HOME/bin/cibuildwheel" "$args"
else
Expand All @@ -156,17 +160,17 @@ NORMALIZED_NAME=$(echo "$NAME" | tr '[:upper:]' '[:lower:]' | tr '-' '_')
VERSION=$(_bump_my_version show current_version)
if [ -z "$VERSION" ]; then
if [ -d src ]; then
FILENAME=src/$NAME/__init__.py
FILENAME=src/$NORMALIZED_NAME/__init__.py
else
FILENAME=$NAME/__init__.py
fi
VERSION=$(grep "__version__ = " "$FILENAME" | awk -F\" '{print $2}')
fi
if [ -z "$VERSION" ]; then
NAME=$(echo "$NAME" | awk -F- '{print $2}')
NORMALIZED_NAME=$(echo "$NAME" | tr '[:upper:]' '[:lower:]')
NORMALIZED_NAME=$(echo "$NAME" | tr '[:upper:]' '[:lower:]' | tr '-' '_')
if [ -d src ]; then
FILENAME=src/$NAME/__init__.py
FILENAME=src/$NORMALIZED_NAME/__init__.py
else
FILENAME=$NAME/__init__.py
fi
Expand All @@ -184,7 +188,7 @@ echo "::endgroup::"
mkdir -p wheelhouse >/dev/null
DIRTY=$(_bump_my_version show scm_info.dirty)
FILEMASK="$NORMALIZED_NAME-$NORMALIZED_VERSION"
FILEEXISTS=$(ls "wheelhouse/$FILEMASK.tar.gz" 2>/dev/null || echo '')
FILEEXISTS=$(find "wheelhouse/$FILEMASK.tar.gz" 2>/dev/null || echo '')
if [ "$DIRTY" == "True" ] || [ -z "$FILEEXISTS" ]; then
echo "::group::Build sdist"
_build_sdist
Expand All @@ -193,7 +197,7 @@ fi
echo "::group::Build wheel(s)"
if [ "$BUILD_TAG" == "$BUILD_TAG_DEFAULT" ]; then
FILEMASK="$NORMALIZED_NAME-$NORMALIZED_VERSION-$PYTHON_TAG-$PYTHON_TAG$PY_ABI_THREAD-$PLATFORM_TAG_MASK"
FILEEXISTS=$(ls "wheelhouse/$FILEMASK.whl" 2>/dev/null || echo '')
FILEEXISTS=$(find "wheelhouse/$FILEMASK.whl" 2>/dev/null || echo '')
if [ "$DIRTY" == "True" ] || [ -z "$FILEEXISTS" ]; then
_build_wheel --only "$BUILD_TAG_DEFAULT"
fi
Expand All @@ -207,11 +211,11 @@ echo "::endgroup::"
if [ "$INSTALL" == "1" ]; then
echo "::group::Install $NORMALIZED_NAME $NORMALIZED_VERSION"
if [[ $PY_PLATFORM == mingw* ]]; then
pip install "$NORMALIZED_NAME==$NORMALIZED_VERSION" -f wheelhouse \
--no-deps --no-index --force-reinstall
PIP_COMMAND="pip install --force-reinstall"
else
uv pip install "$NORMALIZED_NAME==$NORMALIZED_VERSION" -f wheelhouse \
--no-build --no-deps --no-index --prerelease=allow --reinstall
PIP_COMMAND="uv pip install --no-build --prerelease=allow --reinstall"
fi
$PIP_COMMAND "$NORMALIZED_NAME==$NORMALIZED_VERSION" -f wheelhouse \
--no-deps --no-index
echo "::endgroup::"
fi
Loading