Skip to content

We set the package version in 2 places and inconsistently #3302

@jl-wynen

Description

@jl-wynen

The package version is set in 2 places in CMake. In the root CMakeLists.txt (

scipp/CMakeLists.txt

Lines 9 to 14 in 80a8997

execute_process(
COMMAND git describe --tags --abbrev=0 --exclude nightly
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE SCIPP_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
) and in lib/CMakeLists.txt (

scipp/lib/CMakeLists.txt

Lines 92 to 102 in 80a8997

execute_process(
COMMAND git describe --tag
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE HAVE_GIT_VERSION_INFO
OUTPUT_VARIABLE GIT_VERSION_INFO
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(${HAVE_GIT_VERSION_INFO} EQUAL 0)
message(STATUS "Got version from Git: ${GIT_VERSION_INFO}")
add_definitions(-DSCIPP_VERSION="${GIT_VERSION_INFO}")
endif()
).
The first filters out nightly tags and abbreviates. But the second does not. The second is what how we define scipp.__version__ in Python.

Why are there 2 separate commands? Should we remove one? In any case, we should probably filter out nightly in both.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions