|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +from pyarrow.includes.libarrow cimport GetBuildInfo |
| 19 | + |
| 20 | +from collections import namedtuple |
| 21 | + |
| 22 | + |
| 23 | +VersionInfo = namedtuple('VersionInfo', ('major', 'minor', 'patch')) |
| 24 | + |
| 25 | +BuildInfo = namedtuple( |
| 26 | + 'BuildInfo', |
| 27 | + ('version', 'version_info', 'so_version', 'full_so_version', |
| 28 | + 'git_id', 'git_description', 'package_kind')) |
| 29 | + |
| 30 | +cdef _build_info(): |
| 31 | + cdef: |
| 32 | + const CBuildInfo* c_info |
| 33 | + |
| 34 | + c_info = &GetBuildInfo() |
| 35 | + |
| 36 | + return BuildInfo(version=frombytes(c_info.version_string), |
| 37 | + version_info=VersionInfo(c_info.version_major, |
| 38 | + c_info.version_minor, |
| 39 | + c_info.version_patch), |
| 40 | + so_version=frombytes(c_info.so_version), |
| 41 | + full_so_version=frombytes(c_info.full_so_version), |
| 42 | + git_id=frombytes(c_info.git_id), |
| 43 | + git_description=frombytes(c_info.git_description), |
| 44 | + package_kind=frombytes(c_info.package_kind)) |
| 45 | + |
| 46 | + |
| 47 | +cpp_build_info = _build_info() |
| 48 | +cpp_version = cpp_build_info.version |
| 49 | +cpp_version_info = cpp_build_info.version_info |
0 commit comments