From 8e69b498e51e11ac04b1061d450dcbe2ada4ce02 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Wed, 3 Jun 2026 12:10:58 +0200 Subject: [PATCH] Fix version (#319) - install VERSION file and copy to build - fix lookup for VERSION file in case of error - update documentation for installing python bindings --- docs/src/_install.rst | 5 ++++- python/CMakeLists.txt | 6 ++++++ python/aare/_version.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/src/_install.rst b/docs/src/_install.rst index 2c453bd..73a992c 100644 --- a/docs/src/_install.rst +++ b/docs/src/_install.rst @@ -6,7 +6,10 @@ cd build #configure using cmake - cmake ../aare -DCMAKE_INSTALL_PREFIX=/where/to/put/aare + cmake ../aare -DCMAKE_INSTALL_PREFIX=/where/to/put/aare + + #install python bindings + #cmake .. -DCMAKE_INSTALL_PREFIX=/where/to/put/aare -DAARE_INSTALL_PYTHONEXT=ON -DAARE_PYTHON_BINDINGS=ON #build (replace 4 with the number of threads you want to use) make -j4 diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 4cb6d17..2549c4b 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -62,6 +62,8 @@ foreach(FILE ${PYTHON_EXAMPLES}) message(STATUS "Copying ${FILE} to ${CMAKE_BINARY_DIR}/${FILE}") endforeach(FILE ${PYTHON_EXAMPLES}) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../VERSION + ${CMAKE_BINARY_DIR}/aare/VERSION) if(AARE_INSTALL_PYTHONEXT) install( TARGETS _aare @@ -72,4 +74,8 @@ if(AARE_INSTALL_PYTHONEXT) FILES ${PYTHON_FILES} DESTINATION aare COMPONENT python) + install( + FILES ../VERSION + DESTINATION aare + COMPONENT python) endif() diff --git a/python/aare/_version.py b/python/aare/_version.py index d8e2b01..f3530c4 100644 --- a/python/aare/_version.py +++ b/python/aare/_version.py @@ -5,4 +5,4 @@ from pathlib import Path try: __version__ = version('aare') except PackageNotFoundError: - __version__ = Path(__file__).parents[2].joinpath('VERSION').read_text().strip() \ No newline at end of file + __version__ = Path(__file__).parent.joinpath('VERSION').read_text().strip() \ No newline at end of file