Skip to content

Commit

Permalink
Disable version detection (from git) via env/args
Browse files Browse the repository at this point in the history
When packaging for distributions, source code is often managed through
some local revision which may-or-may-not be compatible with the version
detection scheme that is designed for upstream. In these cases it's
useful to quickly enable/disable the version detection.
  • Loading branch information
jokva committed Nov 21, 2017
1 parent b6bac23 commit dc5d9f6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ include(CheckIncludeFile)
include(CTest)
include(GNUInstallDirs)

if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
if (DEFINED ENV{SEGYIO_NO_GIT_VER})
set(SEGYIO_NO_GIT_VER CACHE BOOL "Ignore version from git" ON)
endif ()

if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git AND NOT SEGYIO_NO_GIT_VER)
find_program(git-bin git)
execute_process(COMMAND ${git-bin} describe --tags
OUTPUT_VARIABLE git-describe
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.3.7
* Makefiles can turn off version detection from git from env or via args

# 1.3.6
* Applications no longer spuriously ignore arguments
* All assertClose calls in tests have non-zero epsilon
Expand Down
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@ def getversion():
# if this is a tarball distribution, the .git-directory won't be avilable
# and setuptools_scm will crash hard. good tarballs are built with a
# pre-generated version.py, so parse that and extract version from it
if os.path.isdir(src('.git')):
#
# set the SEGYIO_NO_GIT_VER environment variable to ignore a version from
# git (useful when building for debian or other distributions)
if not 'SEGYIO_NO_GIT_VER' in os.environ and os.path.isdir(src('.git')):
return {
'use_scm_version': {
'root': src(''),
'write_to': src('python/segyio/version.py')
'root': src(''),
'write_to': src('python/segyio/version.py')
}
}

Expand Down

0 comments on commit dc5d9f6

Please sign in to comment.