kou commented on code in PR #37822:
URL: https://github.com/apache/arrow/pull/37822#discussion_r1344887227


##########
python/setup.py:
##########
@@ -133,8 +143,68 @@ def run(self):
                       'bundle the Arrow C++ headers')] +
                     _build_ext.user_options)
 
+    def get_arrow_build_options(self):

Review Comment:
   We can do this in `python/CMakeLists.txt`.
   We can refer all `ARROW_*` variables after `find_package(Arrow)`.
   We can use these values as the default value of `PYARROW_BUILD_*` (Note that 
the following example isn't completed. It breaks at least `PYARROW_CXXFLAGS`.):
   
   ```diff
   diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
   index 29f8d2da7..a002b4e4e 100644
   --- a/python/CMakeLists.txt
   +++ b/python/CMakeLists.txt
   @@ -108,25 +108,6 @@ if(UNIX)
      endif()
    endif()
    
   -# Top level cmake dir
   -if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
   -  option(PYARROW_BUILD_ACERO "Build the PyArrow Acero integration" OFF)
   -  option(PYARROW_BUILD_CUDA "Build the PyArrow CUDA support" OFF)
   -  option(PYARROW_BUILD_DATASET "Build the PyArrow Dataset integration" OFF)
   -  option(PYARROW_BUILD_FLIGHT "Build the PyArrow Flight integration" OFF)
   -  option(PYARROW_BUILD_GANDIVA "Build the PyArrow Gandiva integration" OFF)
   -  option(PYARROW_BUILD_ORC "Build the PyArrow ORC integration" OFF)
   -  option(PYARROW_BUILD_PARQUET "Build the PyArrow Parquet integration" OFF)
   -  option(PYARROW_BUILD_PARQUET_ENCRYPTION
   -         "Build the PyArrow Parquet encryption integration" OFF)
   -  option(PYARROW_BUNDLE_ARROW_CPP "Bundle the Arrow C++ libraries" OFF)
   -  option(PYARROW_BUNDLE_CYTHON_CPP "Bundle the C++ files generated by 
Cython" OFF)
   -  option(PYARROW_GENERATE_COVERAGE "Build with Cython code coverage 
enabled" OFF)
   -  set(PYARROW_CXXFLAGS
   -      ""
   -      CACHE STRING "Compiler flags to append when compiling Arrow")
   -endif()
   -
    find_program(CCACHE_FOUND ccache)
    if(CCACHE_FOUND
       AND NOT CMAKE_C_COMPILER_LAUNCHER
   @@ -267,6 +248,25 @@ include(GNUInstallDirs)
    
    find_package(Arrow REQUIRED)
    
   +# Top level cmake dir
   +if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
   +  option(PYARROW_BUILD_ACERO "Build the PyArrow Acero integration" 
${ARROW_ACERO})
   +  option(PYARROW_BUILD_CUDA "Build the PyArrow CUDA support" ${ARROW_CUDA})
   +  option(PYARROW_BUILD_DATASET "Build the PyArrow Dataset integration" 
${ARROW_DATASET})
   +  option(PYARROW_BUILD_FLIGHT "Build the PyArrow Flight integration" 
${ARROW_FLIGHT})
   +  option(PYARROW_BUILD_GANDIVA "Build the PyArrow Gandiva integration" 
${ARROW_GANDIVA})
   +  option(PYARROW_BUILD_ORC "Build the PyArrow ORC integration" ${ARROW_ORC})
   +  option(PYARROW_BUILD_PARQUET "Build the PyArrow Parquet integration" 
${ARROW_PARQUET})
   +  option(PYARROW_BUILD_PARQUET_ENCRYPTION
   +         "Build the PyArrow Parquet encryption integration" 
${PARQUET_REQUIRE_ENCRYPTION})
   +  option(PYARROW_BUNDLE_ARROW_CPP "Bundle the Arrow C++ libraries" OFF)
   +  option(PYARROW_BUNDLE_CYTHON_CPP "Bundle the C++ files generated by 
Cython" OFF)
   +  option(PYARROW_GENERATE_COVERAGE "Build with Cython code coverage 
enabled" OFF)
   +  set(PYARROW_CXXFLAGS
   +      ""
   +      CACHE STRING "Compiler flags to append when compiling Arrow")
   +endif()
   +
    set(PYARROW_CPP_ROOT_DIR pyarrow/src)
    set(PYARROW_CPP_SOURCE_DIR ${PYARROW_CPP_ROOT_DIR}/arrow/python)
    set(PYARROW_CPP_SRCS
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to