Skip to content

Commit 2c2a61c

Browse files
authored
GH-49566: [Python] Skip header files when installing compiled Cython files and other Python release verification fixes (#49571)
### Rationale for this change Local import is broken when doing editable install with scikit-build-core, also nightly verification jobs are failing for the same reason. ### What changes are included in this PR? - `lib.h` and `lib_api.h` are already installed separately so we skip them when installing Cython extensions into the output destination (`side-packages/pyarrow`). - Arrow library directory is added to the `RPATH`, in the case of not bundling ARROW_CPP, to fix linking issues on macos - `test_pyarrow_include` is updated due to compiled files now being moved to the site-packages - updates to the release verification script when building pyarrow - update of `brew` on the "Install System Dependencies" step in the rc verification job to fix an issue with protobuf mixed versions ### Are these changes tested? Yes, locally and via the extended verification builds. ### Are there any user-facing changes? No. * GitHub Issue: #49566 Lead-authored-by: Raúl Cumplido <raulcumplido@gmail.com> Co-authored-by: AlenkaF <frim.alenka@gmail.com> Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
1 parent c9cc3b8 commit 2c2a61c

4 files changed

Lines changed: 24 additions & 9 deletions

File tree

dev/release/verify-release-candidate.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ test_python() {
538538
show_header "Build and test Python libraries"
539539

540540
# Build and test Python
541-
maybe_setup_virtualenv
541+
maybe_setup_virtualenv -r python/requirements-build.txt
542542
maybe_setup_conda --file ci/conda_env_python.txt
543543

544544
if [ "${USE_CONDA}" -gt 0 ]; then
@@ -570,7 +570,9 @@ test_python() {
570570
pushd python
571571

572572
# Build pyarrow
573-
python -m pip install -e .
573+
python -m pip install --no-build-isolation .
574+
575+
popd
574576

575577
# Check mandatory and optional imports
576578
python -c "
@@ -601,12 +603,10 @@ import pyarrow.parquet
601603

602604

603605
# Install test dependencies
604-
pip install -r requirements-test.txt
606+
pip install -r python/requirements-test.txt
605607

606608
# Execute pyarrow unittests
607-
pytest pyarrow -v
608-
609-
popd
609+
pytest --pyargs pyarrow -v
610610
}
611611

612612
test_glib() {

dev/tasks/verify-rc/github.macos.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ jobs:
5050
brew uninstall pkg-config@0.29.2 || :
5151
{% endif %}
5252
53+
# Workaround for https://github.com/grpc/grpc/issues/41755
54+
# Remove once the runner ships a newer Homebrew.
55+
brew update
56+
5357
brew bundle --file=arrow/cpp/Brewfile
5458
brew bundle --file=arrow/c_glib/Brewfile
5559

python/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,15 @@ message(STATUS "Found Cython version: ${CYTHON_VERSION}")
293293
include(GNUInstallDirs)
294294
find_package(Arrow REQUIRED)
295295

296+
# When not bundling Arrow C++ libraries on macOS, add the Arrow library
297+
# directory to the RPATH so that the extensions can find libarrow at runtime.
298+
if(APPLE
299+
AND NOT PYARROW_BUNDLE_ARROW_CPP
300+
AND ARROW_SHARED_LIB)
301+
get_filename_component(_arrow_lib_dir "${ARROW_SHARED_LIB}" DIRECTORY)
302+
list(APPEND CMAKE_INSTALL_RPATH "${_arrow_lib_dir}")
303+
endif()
304+
296305
macro(define_option name description arrow_option)
297306
set("PYARROW_${name}"
298307
"AUTO"
@@ -968,6 +977,9 @@ foreach(module ${CYTHON_EXTENSIONS})
968977
continue()
969978
endif()
970979
endif()
980+
if(output MATCHES "\\.h$")
981+
continue()
982+
endif()
971983
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${output} DESTINATION ".")
972984
endforeach()
973985
endforeach()

python/pyarrow/tests/test_cpp_internals.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ def test_pyarrow_include():
4949
# created. Either with PyArrow C++ header files or with
5050
# Arrow C++ and PyArrow C++ header files together
5151

52-
source = os.path.dirname(os.path.abspath(__file__))
53-
pyarrow_dir = pjoin(source, '..')
54-
pyarrow_include = pjoin(pyarrow_dir, 'include')
52+
import pyarrow
53+
pyarrow_include = pyarrow.get_include()
5554
pyarrow_cpp_include = pjoin(pyarrow_include, 'arrow', 'python')
5655

5756
assert os.path.exists(pyarrow_include)

0 commit comments

Comments
 (0)