Skip to content
Merged
Show file tree
Hide file tree
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
29 changes: 1 addition & 28 deletions .kokoro/release/crc32c/release-windows-wheel.bat
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,9 @@ cd /d %~dp0..\..\..\packages\google-crc32c || goto :error

if "%PUBLISH_WHEELS%"=="" set PUBLISH_WHEELS=true

@echo "Build and Test Wheels"
@echo "Build, Test, and Publish Wheels"
call scripts\windows\build.bat || goto :error

@echo "Ensure that we have the latest versions of Twine, Wheel, Setuptools, and pkginfo."
call py -3 -m pip install --upgrade twine wheel setuptools pkginfo || goto :error

@echo "Build the source distribution (sdist) and validate with twine check"
call py -3 setup.py sdist || goto :error
call py -3 -m twine check dist/* wheels/google_crc32c* || goto :error

if "%PUBLISH_WHEELS%"=="true" (
@echo "Start the releasetool reporter"
call py -3 -m pip install gcp-releasetool || goto :error
if not exist C:\temp mkdir C:\temp
call py -3 -m releasetool publish-reporter-script > C:\temp\publisher-script || goto :error

@echo "Disable buffering, so that the logs stream through."
set PYTHONUNBUFFERED=1

@echo "## RELEASE WORKFLOW SUCCESSFUL ##"
@echo "## Uploading Wheels and sdist ##"

set /p TWINE_PASSWORD=<%KOKORO_KEYSTORE_DIR%/73713_google-cloud-pypi-token-keystore-3
call py -3 -m twine upload --skip-existing --username __token__ --password "%TWINE_PASSWORD%" dist/* wheels/google_crc32c* || goto :error
dir wheels
dir dist
) else (
@echo "PUBLISH_WHEELS is '%PUBLISH_WHEELS%'. Skipping PyPI upload after sdist and wheel validation."
)

goto :EOF

:error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@ python -m pip install --upgrade "setuptools<71" twine wheel pkginfo
echo "Built wheels in ${REPO_ROOT}/wheels/:"
ls -la "${REPO_ROOT}/wheels/"

for VER in $(awk -F': ' '/^versions:/ {print $2}' "${REPO_ROOT}/scripts/python_versions.yaml"); do
# If BUILD_PYTHON is specified (single version build), only validate wheels for that version.
# Otherwise, validate wheels for all versions listed in python_versions.yaml.
VERSIONS_TO_CHECK=""
if [[ -n "${BUILD_PYTHON}" ]]; then
VERSIONS_TO_CHECK="${BUILD_PYTHON}"
else
VERSIONS_TO_CHECK=$(awk -F': ' '/^versions:/ {print $2}' "${REPO_ROOT}/scripts/python_versions.yaml")
fi

for VER in ${VERSIONS_TO_CHECK}; do
SHORT=$(echo "$VER" | cut -d. -f1,2)
ABI="cp${SHORT//.}-cp${SHORT//.}"
for ARCH in x86_64 aarch64; do
Expand Down
20 changes: 13 additions & 7 deletions packages/google-crc32c/scripts/osx/build_python_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,19 @@ fi
# wheels compatible with older macOS releases.
PYTHON_EXE="/Library/Frameworks/Python.framework/Versions/${PY_BIN}/bin/python${PY_BIN}"
if [[ ! -x "${PYTHON_EXE}" ]]; then
PKG_NAME="python-${PY_VERSION}-macos11.pkg"
echo "Installing Python ${PY_VERSION} from python.org (${PKG_NAME})..."
curl --fail --show-error --location --retry 5 --retry-delay 5 --retry-all-errors \
--output "/tmp/${PKG_NAME}" \
"https://www.python.org/ftp/python/${PY_VERSION}/${PKG_NAME}"
sudo installer -pkg "/tmp/${PKG_NAME}" -target /
rm -f "/tmp/${PKG_NAME}"
if command -v "python${PY_BIN}" >/dev/null 2>&1; then
PYTHON_EXE=$(command -v "python${PY_BIN}")
else
PKG_NAME="python-${PY_VERSION}-macos11.pkg"
# Pre-releases (a1/b1/rc1) are placed under the base version directory on python.org (e.g. 3.15.0a1 -> 3.15.0)
FTP_DIR="${PY_VERSION%%[a-z]*}"
echo "Installing Python ${PY_VERSION} from python.org (${PKG_NAME})..."
curl --fail --show-error --location --retry 5 --retry-delay 5 --retry-all-errors \
--output "/tmp/${PKG_NAME}" \
"https://www.python.org/ftp/python/${FTP_DIR}/${PKG_NAME}"
sudo installer -pkg "/tmp/${PKG_NAME}" -target /
rm -f "/tmp/${PKG_NAME}"
fi
fi
"${PYTHON_EXE}" --version

Expand Down
2 changes: 1 addition & 1 deletion packages/google-crc32c/scripts/python_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
# https://www.python.org/ftp/python/<version>/python-<version>-macos11.pkg
# and Windows installs the matching Chocolatey package.
# Linux (manylinux) and the wheel ABI tags only use the major.minor part.
versions: 3.10.11 3.11.9 3.12.10 3.13.15 3.14.7
versions: 3.10.11 3.11.9 3.12.10 3.13.15 3.14.7 3.15.0rc2
36 changes: 33 additions & 3 deletions packages/google-crc32c/scripts/windows/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,21 @@ set CRC32C_INSTALL_PREFIX=%cd%\build\%CONFIGURATION%
@rem installer seems to have some problems with installing multiple versions at
@rem once, so as a workaround, we will install and then uninstall every version.
for /f "tokens=2 delims=:" %%A in ('findstr /b "versions:" "%~dp0..\python_versions.yaml"') do set SUPPORTED_PYTHON_VERSIONS=%%A
@rem Set PY_PYTHON3 to the first (lowest supported) version in python_versions.yaml so py -3 uses a stable version.
for /f "tokens=1 delims= " %%V in ("%SUPPORTED_PYTHON_VERSIONS%") do for /f "tokens=1,2 delims=." %%I in ("%%V") do set PY_PYTHON3=%%I.%%J
FOR %%P IN (%SUPPORTED_PYTHON_VERSIONS%) DO (
set python_version=%%P
for /f "tokens=1,2 delims=." %%I in ("%%P") do set python_version_trimmed=%%I.%%J

for /L %%R in (1,1,5) do (
py -!python_version_trimmed!-64 --version >nul 2>&1 || (
echo "Installing Python version %%P (attempt %%R/5)"
choco install python --version=%%P -y --no-progress || (
@rem Format pre-release version for Chocolatey (e.g. 3.15.0a1 -> 3.15.0-a1)
set CHOCO_VER=%%P
set CHOCO_VER=!CHOCO_VER:0a=0-a!
set CHOCO_VER=!CHOCO_VER:0b=0-b!
set CHOCO_VER=!CHOCO_VER:0rc=0-rc!
choco install python --version=!CHOCO_VER! --pre -y --no-progress || (
echo "choco install %%P failed; retrying in 15s..."
py -3 -c "import time; time.sleep(15)"
)
Expand Down Expand Up @@ -101,8 +108,31 @@ for %%P in (%SUPPORTED_PYTHON_VERSIONS%) do (
)

echo "Validating built wheels with twine check"
py -3 -m pip install --upgrade twine wheel pkginfo || goto :error
py -3 -m twine check wheels/* || goto :error
py -3 -m pip install --upgrade twine wheel setuptools pkginfo || goto :error

echo "Build the source distribution (sdist) and validate with twine check"
py -3 setup.py sdist || goto :error
py -3 -m twine check dist/* wheels/* || goto :error

if "%PUBLISH_WHEELS%"=="true" (
echo "Start the releasetool reporter"
py -3 -m pip install gcp-releasetool || goto :error
if not exist C:\temp mkdir C:\temp
py -3 -m releasetool publish-reporter-script > C:\temp\publisher-script || goto :error

echo "Disable buffering, so that the logs stream through."
set PYTHONUNBUFFERED=1

echo "## RELEASE WORKFLOW SUCCESSFUL ##"
echo "## Uploading Wheels and sdist ##"

set /p TWINE_PASSWORD=<%KOKORO_KEYSTORE_DIR%/73713_google-cloud-pypi-token-keystore-3
py -3 -m twine upload --skip-existing --username __token__ --password "%TWINE_PASSWORD%" dist/* wheels/* || goto :error
dir wheels
dir dist
) else (
echo "PUBLISH_WHEELS is '%PUBLISH_WHEELS%'. Skipping PyPI upload after sdist and wheel validation."
)

goto :EOF

Expand Down
Loading