From 8bfef2e62f38d0660e71e43dc30081fc9004f811 Mon Sep 17 00:00:00 2001 From: Dilawar Singh <dilawars@ncbs.res.in> Date: Mon, 14 Nov 2016 13:48:12 +0530 Subject: [PATCH] Squashed 'moose-core/' changes from ed5f015..343cb02 343cb02 Fixes to VERSION issue BhallaLab/moose#200. 835bf9a Added a version file. git-subtree-dir: moose-core git-subtree-split: 343cb02705b0874ad0035eea648019420475f7ed --- CMakeLists.txt | 23 ++++++++++++++--------- VERSION | 1 + python/setup.py | 13 +++++++++---- 3 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 VERSION diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f0268ea..51a2009e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,25 +17,30 @@ include(FindPkgConfig) # If from command line, version info is not passed, use the git to generate a # version file. If GIT fails, use the previous known version. -set(VERSION_FILE ${CMAKE_SOURCE_DIRECTORY}/VERSION) +set(VERSION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/VERSION) find_program(GIT_EXEC "git") message( STATUS "Looking for git ${GIT_EXEC}" ) -if( (NOT VERSION) AND GITEXEC) +if( (NOT MOOSE_VERSION) AND GIT_EXEC) execute_process( COMMAND ${GIT_EXEC} describe --tags --long WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_VERSION_OUTPUT + OUTPUT_VARIABLE MOOSE_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) - file(WRITE ${VERSION_FILE} ${GIT_VERSION_OUTPUT}) - add_definitions( -DMOOSE_VERSION="${GIT_VERSION_OUTPUT}") -elseif( (NOT VERSION) AND (NOT GIT_EXEC) ) - file( READ ${VERSION_FILE} GIT_VERSION_OUTPUT ) - add_definitions( -DMOOSE_VERSION="${GIT_VERSION_OUTPUT}") + message(STATUS "+ Writing ${MOOSE_VERSION} to ${VERSION_FILE}" ) + file(WRITE ${VERSION_FILE} ${MOOSE_VERSION}) +elseif( (NOT MOOSE_VERSION) AND (NOT GIT_EXEC) ) + message(STATUS "+ Reading ${VERSION_FILE}" ) + file(READ ${VERSION_FILE} GIT_VERSION_OUTPUT ) +elseif(MOOSE_VERSION) + message(STATUS "+ Using user VERSION ${MOOSE_VERSION}" ) + file(WRITE ${VERSION_FILE} ${MOOSE_VERSION}) else() - add_definitions( -DMOOSE_VERSION="${VERSION}") + message(FATAL_ERROR "Could not determine MOOSE_VERSION" ) endif( ) +add_definitions( -DMOOSE_VERSION="${MOOSE_VERSION}") +message( STATUS "MOOSE Version ${MOOSE_VERSION}" ) # This snippet is from LLVM project. # Sanity check our source directory to make sure that we are not trying to diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..8dd31a6d --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +3.1.0-119-g835bf9a \ No newline at end of file diff --git a/python/setup.py b/python/setup.py index 18638088..92ef412c 100644 --- a/python/setup.py +++ b/python/setup.py @@ -31,6 +31,9 @@ __status__ = "Development" import os from distutils.core import setup +with open( '../../VERSION', 'r' ) as f: + version = f.read( ) + try: import importlib.machinery suffix = importlib.machinery.EXTENSION_SUFFIXES[0] @@ -39,21 +42,23 @@ except Exception as e: setup( name='moose', - version='3.0.2', + version=version, description='MOOSE python scripting module.', - author='Dilwar Singh', - author_email='dilawars@ncbs.res.in', + author='MOOSERes', + author_email='bhalla@ncbs.res.in', + maintainer='Dilawar Singh', + maintainer_email='dilawars@ncbs.res.in', url='http://moose.ncbs.res.in', packages=[ 'rdesigneur' , 'moose' + , 'moose.SBML' , 'moose.neuroml' , 'moose.genesis' ], package_dir = { 'moose' : 'moose' , 'rdesigneur' : 'rdesigneur' - , 'genesis' : 'genesis' }, package_data = { 'moose' : ['_moose' + suffix] }, ) -- GitLab