Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
wrappers
python
find_librs_version.py
Go to the documentation of this file.
1
import
io
2
import
re
3
import
sys
4
import
os
5
6
librs_version =
''
7
if
len(sys.argv) < 3:
8
print
(
"Error! Usage: find_librs_version.py <absolute_path_to_librealsense> <output_dir>"
)
9
exit
(1)
10
11
librealsense_dir = sys.argv[1]
12
output_dir = sys.argv[2]
13
14
rs_h_path = os.path.join(librealsense_dir,
'include/librealsense2/rs.h'
)
15
print
(
"Extracting version from: "
, rs_h_path)
16
with io.open(rs_h_path,
'r') as f:
17
file_content = f.read()
18
major = re.search(r"#define\s*RS2_API_MAJOR_VERSION\s*(\d+)"
,file_content)
19
if
not
major:
20
raise
Exception(
'No major number'
)
21
librs_version += major.group(1)
22
librs_version +=
'.'
23
minor = re.search(
r"#define\s*RS2_API_MINOR_VERSION\s*(\d+)"
,file_content)
24
if
not
minor:
25
raise
Exception(
'No minor number'
)
26
librs_version += minor.group(1)
27
librs_version +=
'.'
28
patch = re.search(
r"#define\s*RS2_API_PATCH_VERSION\s*(\d+)"
,file_content)
29
if
not
patch:
30
raise
Exception(
'No patch number'
)
31
librs_version += patch.group(1)
32
33
print
(
"Librealsense Version: "
, librs_version)
34
outfile = os.path.join(output_dir,
'_version.py'
)
35
print
(
"Writing version to: "
, outfile)
36
with open(outfile,
'w'
)
as
f:
37
f.write(
'__version__ = "{}"'
.format(librs_version))
print
static std::string print(const transformation &tf)
Definition:
rs-pose-apriltag.cpp:64
rs2::textual_icons::exit
static const textual_icon exit
Definition:
model-views.h:254
librealsense2
Author(s): Sergey Dorodnicov
, Doron Hirshberg
, Mark Horn
, Reagan Lopez
, Itay Carpis
autogenerated on Mon May 3 2021 02:47:14