From 6e1ec4314f1ad389c1c12db7b37a8e8904b5d628 Mon Sep 17 00:00:00 2001 From: Piotr Jarosik Date: Wed, 30 Jun 2021 10:59:58 +0200 Subject: [PATCH] Added __version__ attribute in ARRUS Python main module. --- api/python/CMakeLists.txt | 11 ++++++++++- api/python/arrus/__init__.py | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/api/python/CMakeLists.txt b/api/python/CMakeLists.txt index cdc131239..058cd6694 100644 --- a/api/python/CMakeLists.txt +++ b/api/python/CMakeLists.txt @@ -100,16 +100,25 @@ set(TEST_FILES "arrus/tests/us4oem_kernels_test.py" ) -set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in") +set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in") set(SETUP_PY_OUT "${CMAKE_CURRENT_BINARY_DIR}/setup.py") +set(INIT_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/arrus/__init__.py") +set(INIT_PY_OUT "${CMAKE_CURRENT_BINARY_DIR}/tmp/__init__.py") + set(TIMESTAMP "${CMAKE_CURRENT_BINARY_DIR}/timestamp") configure_file(${SETUP_PY_IN} ${SETUP_PY_OUT}) +configure_file(${INIT_PY_IN} ${INIT_PY_OUT}) + add_custom_command(OUTPUT ${TIMESTAMP} COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/arrus ${CMAKE_CURRENT_BINARY_DIR}/arrus + # Override __init__.py file with the correct Python package version. + COMMAND + ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_BINARY_DIR}/tmp/__init__.py ${CMAKE_CURRENT_BINARY_DIR}/arrus COMMAND ${CMAKE_COMMAND} -E copy_directory ${Us4_ROOT_DIR}/lib64 ${CMAKE_CURRENT_BINARY_DIR}/arrus diff --git a/api/python/arrus/__init__.py b/api/python/arrus/__init__.py index 7ceb67339..d2debba17 100644 --- a/api/python/arrus/__init__.py +++ b/api/python/arrus/__init__.py @@ -5,6 +5,8 @@ os.environ["PATH"] += os.pathsep + os.path.dirname(os.path.join(os.path.abspath(__file__))) +__version__ = "${PROJECT_VERSION}" + from arrus.session import Session from arrus.logging import ( set_clog_level,