Skip to content

Commit

Permalink
Switch to Versioneer.py for version string generation (kotekan#664)
Browse files Browse the repository at this point in the history
Sets the `kotekan` version using `versioneer`. Closes kotekan#663.

Co-authored-by: Rick Nitsche <[email protected]>
  • Loading branch information
2 people authored and andrerenard committed Jan 22, 2020
1 parent cc0b0ea commit 8f79803
Show file tree
Hide file tree
Showing 10 changed files with 2,475 additions and 297 deletions.
16 changes: 15 additions & 1 deletion lib/version/make_version.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,26 @@ execute_process(
)

execute_process(
COMMAND python3 ${SOURCE_DIR}/python/kotekan/version.py
COMMAND python ${SOURCE_DIR}/python/print_kotekan_version.py
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE KOTEKAN_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)

execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE KOTEKAN_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# Remove branch name if we are on master
if (${KOTEKAN_BRANCH} MATCHES "master")
set(FULL_KOTEKAN_VERSION "${KOTEKAN_VERSION}")
else()
set(FULL_KOTEKAN_VERSION "${KOTEKAN_BRANCH}.${KOTEKAN_VERSION}")
endif()

configure_file(
${CURRENT_SOURCE_DIR}/version.c.in
${CURRENT_BINARY_DIR}/version.c
Expand Down
2 changes: 1 addition & 1 deletion lib/version/version.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "version.h"

char * __kotekan_version = "@KOTEKAN_VERSION@";
char * __kotekan_version = "@FULL_KOTEKAN_VERSION@";

char * __git_branch = "@GIT_BRANCH@";

Expand Down
2 changes: 1 addition & 1 deletion lib/version/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extern "C" {

/**
* @brief Get the kotekan version string
* See python/kotekan/version.py to see how this is generated
* The version is generated using versioneer, see python/_version.py
* This version is updated every time make is called
*
* @return The kotekan version string
Expand Down
1 change: 1 addition & 0 deletions python/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_version.py export-subst
Loading

0 comments on commit 8f79803

Please sign in to comment.