]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
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 | 'compiler_id', 'compiler_version', 'compiler_flags', | |
29 | 'git_id', 'git_description', 'package_kind')) | |
30 | ||
31 | RuntimeInfo = namedtuple('RuntimeInfo', | |
32 | ('simd_level', 'detected_simd_level')) | |
33 | ||
34 | cdef _build_info(): | |
35 | cdef: | |
36 | const CBuildInfo* c_info | |
37 | ||
38 | c_info = &GetBuildInfo() | |
39 | ||
40 | return BuildInfo(version=frombytes(c_info.version_string), | |
41 | version_info=VersionInfo(c_info.version_major, | |
42 | c_info.version_minor, | |
43 | c_info.version_patch), | |
44 | so_version=frombytes(c_info.so_version), | |
45 | full_so_version=frombytes(c_info.full_so_version), | |
46 | compiler_id=frombytes(c_info.compiler_id), | |
47 | compiler_version=frombytes(c_info.compiler_version), | |
48 | compiler_flags=frombytes(c_info.compiler_flags), | |
49 | git_id=frombytes(c_info.git_id), | |
50 | git_description=frombytes(c_info.git_description), | |
51 | package_kind=frombytes(c_info.package_kind)) | |
52 | ||
53 | ||
54 | cpp_build_info = _build_info() | |
55 | cpp_version = cpp_build_info.version | |
56 | cpp_version_info = cpp_build_info.version_info | |
57 | ||
58 | ||
59 | def runtime_info(): | |
60 | """ | |
61 | Get runtime information. | |
62 | ||
63 | Returns | |
64 | ------- | |
65 | info : pyarrow.RuntimeInfo | |
66 | """ | |
67 | cdef: | |
68 | CRuntimeInfo c_info | |
69 | ||
70 | c_info = GetRuntimeInfo() | |
71 | ||
72 | return RuntimeInfo( | |
73 | simd_level=frombytes(c_info.simd_level), | |
74 | detected_simd_level=frombytes(c_info.detected_simd_level)) |