Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cmake/MacroHelper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,21 @@ endfunction()
function(add_cpp_git_information target scope)
find_program(GIT git)
if(EXISTS "${PROJECT_SOURCE_DIR}/.git" AND GIT)
# Shallow clones: tags may not be ancestors of HEAD, so describe fails and GIT_DESCRIBE would
# stay empty (neuron.__version__ / nrnversion(5)). Fall back to PROJECT_VERSION so release
# dry-run and ship wheels match.
execute_process(
COMMAND "${GIT}" -C "${PROJECT_SOURCE_DIR}" describe
OUTPUT_VARIABLE GIT_DESCRIBE
RESULT_VARIABLE GIT_DESCRIBE_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)

if(GIT_DESCRIBE_RESULT OR "${GIT_DESCRIBE}" STREQUAL "")
set(GIT_DESCRIBE "${PROJECT_VERSION}")
message(
STATUS "git describe failed or empty; falling back to PROJECT_VERSION=${PROJECT_VERSION}")
endif()

execute_process(
COMMAND "${GIT}" -C "${PROJECT_SOURCE_DIR}" rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE GIT_BRANCH
Expand Down
2 changes: 2 additions & 0 deletions packaging/python/test_wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ $python_exe -m uv pip install -r packaging/python/test_requirements.txt
$python_exe -m uv pip install --force-reinstall $python_wheel
$python_exe -m uv pip show neuron || $python_exe -m uv pip show neuron-nightly

# neuron.__version__ is nrnversion(5)/GIT_DESCRIBE; empty breaks ModelDB workdir naming
$python_exe -c "import neuron; v = neuron.__version__; assert v and str(v).strip(), repr(v)"

# check the existence of coreneuron support
compile_options="$(nrniv -nobanner -nogui -c 'nrnversion(6)')"
Expand Down
Loading