mirror of
https://github.com/EttusResearch/uhd.git
synced 2026-10-25 17:36:10 +00:00
python: Add version API calls
New API calls in UHD Python API: - get_version_string() - get_abi_string() - get_component()
This commit is contained in:
parent
f3815f3384
commit
736d20ea95
19
host/lib/version_python.hpp
Normal file
19
host/lib/version_python.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
//
|
||||
// Copyright 2024 Ettus Research, a National Instruments Brand
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
//
|
||||
|
||||
#ifndef INCLUDED_UHD_VERSION_PYTHON_HPP
|
||||
#define INCLUDED_UHD_VERSION_PYTHON_HPP
|
||||
|
||||
#include <uhd/version.hpp>
|
||||
|
||||
void export_version(py::module& m)
|
||||
{
|
||||
m.def("get_version_string", &uhd::get_version_string);
|
||||
m.def("get_abi_string", &uhd::get_abi_string);
|
||||
m.def("get_component", &uhd::get_component);
|
||||
}
|
||||
|
||||
#endif /* INCLUDED_UHD_VERSION_PYTHON_HPP */
|
||||
@ -46,6 +46,7 @@ namespace py = pybind11;
|
||||
#include "usrp/subdev_spec_python.hpp"
|
||||
#include "utils/paths_python.hpp"
|
||||
#include "utils/utils_python.hpp"
|
||||
#include "version_python.hpp"
|
||||
|
||||
// We need this hack because import_array() returns NULL
|
||||
// for newer Python versions.
|
||||
@ -66,6 +67,9 @@ PYBIND11_MODULE(libpyuhd, m)
|
||||
// Register uhd::device::find
|
||||
export_device(m);
|
||||
|
||||
// Register version API
|
||||
export_version(m);
|
||||
|
||||
// Register paths submodule
|
||||
auto paths_module = m.def_submodule("paths", "Path Utilities");
|
||||
export_paths(paths_module);
|
||||
|
||||
@ -16,6 +16,7 @@ from . import dsp
|
||||
from . import chdr
|
||||
from .libpyuhd.paths import *
|
||||
from .libpyuhd import find
|
||||
from .libpyuhd import get_version_string, get_abi_string, get_component
|
||||
from .property_tree import PropertyTree
|
||||
|
||||
|
||||
__version__ = get_version_string()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user