Skip to content

Commit

Permalink
add to verification script
Browse files Browse the repository at this point in the history
  • Loading branch information
paleolimbot committed Jan 12, 2024
1 parent 712082e commit 708a430
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions dev/release/verify-release-candidate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,57 @@ test_r() {
popd
}

activate_or_create_venv() {
if [ ! -z "${NANOARROW_PYTHON_VENV}" ]; then
show_info "Activating virtual environment at ${NANOARROW_PYTHON_VENV}"
# TODO: Move to dockerfiles
apt-get install -y python3-dev
source "${NANOARROW_PYTHON_VENV}/bin/activate"
else
# Try python3 first, then try regular python (e.g., Windows)
if [ -z "${PYTHON_BIN}" ] && python3 --version >/dev/null; then
PYTHON_BIN=python3
elif [ -z "${PYTHON_BIN}" ]; then
PYTHON_BIN=python
fi

show_info "Creating temporary virtual environment using ${PYTHON_BIN}..."
"${PYTHON_BIN}" -m venv "${NANOARROW_TMPDIR}/venv"
source "${NANOARROW_TMPDIR}/venv/bin/activate"
pip install --upgrade pip
fi
}

test_python() {
show_header "Build and test Python package"
activate_or_create_venv

show_info "Installing build utilities"
pip install --upgrade build

pushd "${NANOARROW_SOURCE_DIR}/python"

show_info "Building sdist and wheel"
rm -rf "${NANOARROW_TMPDIR}/python"
python -m build --sdist --wheel --outdir "${NANOARROW_TMPDIR}/python"
PYTHON_SDIST_NAME=$(ls "${NANOARROW_TMPDIR}/python" | grep -e ".tar.gz")
PYTHON_WHEEL_NAME=$(ls "${NANOARROW_TMPDIR}/python" | grep -e ".whl")

show_info "Installing from sdist"
pip install "${NANOARROW_TMPDIR}/python/${PYTHON_SDIST_NAME}[test]"

show_info "Testing source distribution"
python -m pytest -vv

show_info "Installing from wheel"
pip install --force-reinstall "${NANOARROW_TMPDIR}/python/${PYTHON_WHEEL_NAME}"

show_info "Testing wheel"
python -m pytest -vv

popd
}

ensure_source_directory() {
show_header "Ensuring source directory"

Expand Down Expand Up @@ -346,6 +397,10 @@ test_source_distribution() {
test_r
fi

if [ ${TEST_PYTHON} -gt 0 ]; then
test_python
fi

popd
}

Expand All @@ -359,6 +414,7 @@ test_source_distribution() {
: ${TEST_C:=${TEST_SOURCE}}
: ${TEST_C_BUNDLED:=${TEST_C}}
: ${TEST_R:=${TEST_SOURCE}}
: ${TEST_PYTHON:=${TEST_SOURCE}}

TEST_SUCCESS=no

Expand Down

0 comments on commit 708a430

Please sign in to comment.