From 8395012beee6886c54c635fdbf1f76ac1f28f4f1 Mon Sep 17 00:00:00 2001 From: Jens Georg Date: Fri, 22 May 2026 16:38:08 +0200 Subject: [PATCH] feat: Add __version__ attribute to deviceaccess --- CMakeLists.txt | 3 +++ src/deviceaccessPython.cc | 1 + 2 files changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cd8bba..32e1b1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,9 @@ set_property( TARGET ${PROJECT_NAME} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE ) # set the right output file name for the the python core module library set_target_properties( ${PROJECT_NAME} PROPERTIES PREFIX "" OUTPUT_NAME "deviceaccess" ) +target_compile_definitions(${PROJECT_NAME} PRIVATE + PYTHON_MODULE_VERSION="${${PROJECT_NAME}_VERSION}") + # Copy Python part to build directory (required for tests to run) file( COPY mtca4u.py DESTINATION ${PROJECT_BINARY_DIR} ) diff --git a/src/deviceaccessPython.cc b/src/deviceaccessPython.cc index b2d44d3..e098f45 100644 --- a/src/deviceaccessPython.cc +++ b/src/deviceaccessPython.cc @@ -165,4 +165,5 @@ PYBIND11_MODULE(deviceaccess, m) { exc("Thread Interrupted"); } }); + m.attr("__version__") = PYTHON_MODULE_VERSION; }