This is an automated email from the ASF dual-hosted git repository.
assignuser pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new d7641dcd65 GH-44614: [Python][C++] Add version suffix to
libarrow_python* libraries (#44702)
d7641dcd65 is described below
commit d7641dcd65c41207970e3b9cdef81eb9ae89193c
Author: Raúl Cumplido <[email protected]>
AuthorDate: Wed Nov 13 02:24:36 2024 +0100
GH-44614: [Python][C++] Add version suffix to libarrow_python* libraries
(#44702)
### Rationale for this change
We are currently not setting library version suffixes for arrow python C++
libraries but we do so for libarrow C++.
### What changes are included in this PR?
Add the same logic that we use for libarrow.
### Are these changes tested?
I've validated manually that the suffixes are generated.
```
tree | grep libarrow_python
│ │ ├── libarrow_python.so -> libarrow_python.so.1900
│ │ ├── libarrow_python.so.1900 -> libarrow_python.so.1900.0.0
│ │ ├── libarrow_python.so.1900.0.0
│ │ ├── libarrow_python.pxd
│ ├── libarrow_python.so -> libarrow_python.so.1900
│ ├── libarrow_python.so.1900 -> libarrow_python.so.1900.0.0
│ ├── libarrow_python.so.1900.0.0
```
### Are there any user-facing changes?
We will generate so libraries with version suffixes.
* GitHub Issue: #44614
Authored-by: Raúl Cumplido <[email protected]>
Signed-off-by: Jacob Wujciak-Jens <[email protected]>
---
python/CMakeLists.txt | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 335efced17..c39a1129ac 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -31,6 +31,16 @@ set(CMAKE_NO_SYSTEM_FROM_IMPORTED ON)
set(PYARROW_VERSION "19.0.0-SNAPSHOT")
string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" PYARROW_BASE_VERSION
"${PYARROW_VERSION}")
+# Generate SO version and full SO version
+project(pyarrow VERSION "${PYARROW_BASE_VERSION}")
+set(PYARROW_VERSION_MAJOR "${pyarrow_VERSION_MAJOR}")
+set(PYARROW_VERSION_MINOR "${pyarrow_VERSION_MINOR}")
+set(PYARROW_VERSION_PATCH "${pyarrow_VERSION_PATCH}")
+# pyarrow 1.x.y => SO version is "10x", full SO version is "10x.y.0"
+# Example: for 18.0.0 --> PYARROW_SO_VERSION=1800,
PYARROW_FULL_SO_VERSION=1800.0.0
+math(EXPR PYARROW_SO_VERSION "${PYARROW_VERSION_MAJOR} * 100 +
${PYARROW_VERSION_MINOR}")
+set(PYARROW_FULL_SO_VERSION "${PYARROW_SO_VERSION}.${PYARROW_VERSION_PATCH}.0")
+
# Running from a Python sdist tarball
set(LOCAL_CMAKE_MODULES "${CMAKE_SOURCE_DIR}/cmake_modules")
if(EXISTS "${LOCAL_CMAKE_MODULES}")
@@ -470,6 +480,8 @@ else()
endif()
target_link_libraries(arrow_python PUBLIC Python3::NumPy)
target_compile_definitions(arrow_python PRIVATE ARROW_PYTHON_EXPORTING)
+set_target_properties(arrow_python PROPERTIES VERSION
"${PYARROW_FULL_SO_VERSION}"
+ SOVERSION
"${PYARROW_SO_VERSION}")
install(TARGETS arrow_python
ARCHIVE DESTINATION .
LIBRARY DESTINATION .
@@ -485,6 +497,9 @@ else()
${PARQUET_LINK_LIBS})
target_compile_definitions(arrow_python_parquet_encryption
PRIVATE
ARROW_PYTHON_PARQUET_ENCRYPTION_EXPORTING)
+ set_target_properties(arrow_python_parquet_encryption
+ PROPERTIES VERSION "${PYARROW_FULL_SO_VERSION}"
+ SOVERSION "${PYARROW_SO_VERSION}")
install(TARGETS arrow_python_parquet_encryption
ARCHIVE DESTINATION .
LIBRARY DESTINATION .
@@ -515,6 +530,9 @@ if(PYARROW_BUILD_FLIGHT)
target_link_libraries(arrow_python_flight PUBLIC arrow_python
ArrowFlight::arrow_flight_shared)
target_compile_definitions(arrow_python_flight PRIVATE
ARROW_PYFLIGHT_EXPORTING)
+ set_target_properties(arrow_python_flight
+ PROPERTIES VERSION "${PYARROW_FULL_SO_VERSION}"
+ SOVERSION "${PYARROW_SO_VERSION}")
install(TARGETS arrow_python_flight
ARCHIVE DESTINATION .
LIBRARY DESTINATION .