Skip to content

Commit 8f43a9f

Browse files
authored
ARROW-18322: [Python] Add PYARROW_WITH_FLIGHT to PyArrow C++ cmake (apache#14642)
This PR adds the use of `PYARROW_WITH_FLIGHT` environment variable when building PyArrow C++. With this change PyArrow will be able to build successfully even when Arrow C++ is installed without Arrow Flight ([example](https://github.com/OSGeo/gdal/blob/58ab718542a7b5ceb94e3f24a5acc0b18ac1efb2/docker/ubuntu-full/Dockerfile#L223-L231), JFrog artifactory) but `ARROW_FLIGHT` flag is not registered to be set to off. Note: `PYARROW_WITH_FLIGHT=0` is needed when building PyArrow. I tested the change on my regular build with Arrow Flight but with removed `libarrow_flight*` libs. Without this patch I get: ``` CMake Error at /Users/alenkafrim/repos/arrow/dist/lib/cmake/ArrowFlight/ArrowFlightTargets.cmake:93 (message): The imported target "ArrowFlight::arrow_flight_shared" references the file "/Users/alenkafrim/repos/arrow/dist/lib/libarrow_flight.1100.0.0.dylib" but this file does not exist. Possible reasons include: * The file was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and contained "/Users/alenkafrim/repos/arrow/dist/lib/cmake/ArrowFlight/ArrowFlightTargets.cmake" but not all the files it references. Call Stack (most recent call first): /Users/alenkafrim/repos/arrow/dist/lib/cmake/ArrowFlight/ArrowFlightConfig.cmake:56 (include) CMakeLists.txt:262 (find_package) ``` With this patch PyArrow builds succesfully. Authored-by: Alenka Frim <frim.alenka@gmail.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
1 parent 77f099f commit 8f43a9f

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎python/pyarrow/src/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ if(ARROW_BUILD_STATIC AND MSVC)
253253
target_compile_definitions(arrow_python_static PUBLIC ARROW_STATIC)
254254
endif()
255255

256-
if(ARROW_FLIGHT AND ARROW_BUILD_SHARED)
256+
if(PYARROW_WITH_FLIGHT AND ARROW_FLIGHT AND ARROW_BUILD_SHARED)
257257
# Must link to shared libarrow_flight: we don't want to link more than one
258258
# copy of gRPC into the eventual Cython shared object, otherwise gRPC calls
259259
# fail with weird errors due to multiple copies of global static state (The

‎python/setup.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ def append_cmake_bool(value, varname):
270270
'PYARROW_WITH_PARQUET_ENCRYPTION')
271271
append_cmake_bool(self.with_hdfs,
272272
'PYARROW_WITH_HDFS')
273+
append_cmake_bool(self.with_flight,
274+
'PYARROW_WITH_FLIGHT')
273275

274276
# Windows
275277
if self.cmake_generator:

0 commit comments

Comments
 (0)