This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 8daf756  ARROW-9446: [C++] Add compiler id, version, and build flags 
to BuildInfo
8daf756 is described below

commit 8daf7560a8249b36049e88dbfae45d0b411bd78e
Author: Wes McKinney <[email protected]>
AuthorDate: Tue Jul 14 06:12:47 2020 +0900

    ARROW-9446: [C++] Add compiler id, version, and build flags to BuildInfo
    
    Example output:
    
    ```
    In [1]: pa.show_versions()
    pyarrow version info
    --------------------
    Package kind: not indicated
    Arrow C++ library version: 1.0.0-SNAPSHOT
    Arrow C++ compiler: GNU 8.4.0
    Arrow C++ compiler flags:  -fdiagnostics-color=always -O3 -DNDEBUG
    Arrow C++ git revision: feda9877f8145aebf907c61a24640735a968a230
    Arrow C++ git description: apache-arrow-0.17.0-708-gfeda9877f-dirty
    ```
    
    Closes #7738 from wesm/cxxflags-build-info
    
    Authored-by: Wes McKinney <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 cpp/src/arrow/config.cc              |  3 +++
 cpp/src/arrow/config.h               |  3 +++
 cpp/src/arrow/util/config.h.cmake    |  4 ++++
 python/pyarrow/__init__.py           | 10 +++++++---
 python/pyarrow/config.pxi            |  4 ++++
 python/pyarrow/includes/libarrow.pxd |  3 +++
 6 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/cpp/src/arrow/config.cc b/cpp/src/arrow/config.cc
index 72fe45b..f35e89d 100644
--- a/cpp/src/arrow/config.cc
+++ b/cpp/src/arrow/config.cc
@@ -29,6 +29,9 @@ static const BuildInfo kBuildInfo = {
     ARROW_VERSION_STRING,
     ARROW_SO_VERSION,
     ARROW_FULL_SO_VERSION,
+    ARROW_CXX_COMPILER_ID,
+    ARROW_CXX_COMPILER_VERSION,
+    ARROW_CXX_COMPILER_FLAGS,
     ARROW_GIT_ID,
     ARROW_GIT_DESCRIPTION,
     ARROW_PACKAGE_KIND,
diff --git a/cpp/src/arrow/config.h b/cpp/src/arrow/config.h
index 6457426..518869d 100644
--- a/cpp/src/arrow/config.h
+++ b/cpp/src/arrow/config.h
@@ -37,6 +37,9 @@ struct BuildInfo {
   std::string version_string;
   std::string so_version;
   std::string full_so_version;
+  std::string compiler_id;
+  std::string compiler_version;
+  std::string compiler_flags;
   std::string git_id;
   std::string git_description;
   std::string package_kind;
diff --git a/cpp/src/arrow/util/config.h.cmake 
b/cpp/src/arrow/util/config.h.cmake
index f0c2b01..8fb255b 100644
--- a/cpp/src/arrow/util/config.h.cmake
+++ b/cpp/src/arrow/util/config.h.cmake
@@ -25,6 +25,10 @@
 #define ARROW_SO_VERSION "@ARROW_SO_VERSION@"
 #define ARROW_FULL_SO_VERSION "@ARROW_FULL_SO_VERSION@"
 
+#define ARROW_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@"
+#define ARROW_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@"
+#define ARROW_CXX_COMPILER_FLAGS "@CMAKE_CXX_FLAGS@"
+
 #define ARROW_GIT_ID "@ARROW_GIT_ID@"
 #define ARROW_GIT_DESCRIPTION "@ARROW_GIT_DESCRIPTION@"
 
diff --git a/python/pyarrow/__init__.py b/python/pyarrow/__init__.py
index 2541855..e011ee7 100644
--- a/python/pyarrow/__init__.py
+++ b/python/pyarrow/__init__.py
@@ -77,9 +77,13 @@ def show_versions():
     print("Package kind: {}".format(cpp_build_info.package_kind
                                     if len(cpp_build_info.package_kind) > 0
                                     else "not indicated"))
-    print("Arrow C++ library version: {}".format(cpp_build_info.version))
-    print("Arrow C++ git revision: {}".format(cpp_build_info.git_id))
-    print("Arrow C++ git description: {}"
+    print("Arrow C++ library version: {0}".format(cpp_build_info.version))
+    print("Arrow C++ compiler: {0} {1}"
+          .format(cpp_build_info.compiler_id, cpp_build_info.compiler_version))
+    print("Arrow C++ compiler flags: {0}"
+          .format(cpp_build_info.compiler_flags))
+    print("Arrow C++ git revision: {0}".format(cpp_build_info.git_id))
+    print("Arrow C++ git description: {0}"
           .format(cpp_build_info.git_description))
 
 
diff --git a/python/pyarrow/config.pxi b/python/pyarrow/config.pxi
index b806d40..a61f485 100644
--- a/python/pyarrow/config.pxi
+++ b/python/pyarrow/config.pxi
@@ -25,6 +25,7 @@ VersionInfo = namedtuple('VersionInfo', ('major', 'minor', 
'patch'))
 BuildInfo = namedtuple(
     'BuildInfo',
     ('version', 'version_info', 'so_version', 'full_so_version',
+     'compiler_id', 'compiler_version', 'compiler_flags',
      'git_id', 'git_description', 'package_kind'))
 
 cdef _build_info():
@@ -39,6 +40,9 @@ cdef _build_info():
                                               c_info.version_patch),
                      so_version=frombytes(c_info.so_version),
                      full_so_version=frombytes(c_info.full_so_version),
+                     compiler_id=frombytes(c_info.compiler_id),
+                     compiler_version=frombytes(c_info.compiler_version),
+                     compiler_flags=frombytes(c_info.compiler_flags),
                      git_id=frombytes(c_info.git_id),
                      git_description=frombytes(c_info.git_description),
                      package_kind=frombytes(c_info.package_kind))
diff --git a/python/pyarrow/includes/libarrow.pxd 
b/python/pyarrow/includes/libarrow.pxd
index 3e461c4..213ef24 100644
--- a/python/pyarrow/includes/libarrow.pxd
+++ b/python/pyarrow/includes/libarrow.pxd
@@ -59,6 +59,9 @@ cdef extern from "arrow/api.h" namespace "arrow" nogil:
         c_string version_string
         c_string so_version
         c_string full_so_version
+        c_string compiler_id
+        c_string compiler_version
+        c_string compiler_flags
         c_string git_id
         c_string git_description
         c_string package_kind

Reply via email to