From 101ea276d1e5f7bcabb5c46d199d87a8c6cb0295 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Fri, 10 May 2013 13:45:18 -0700 Subject: [PATCH] add mapnik version number reporting to mapnik-config --- SConstruct | 5 ++++- utils/mapnik-config/build.py | 8 +++----- utils/mapnik-config/mapnik-config.template.sh | 11 ++++++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/SConstruct b/SConstruct index 10ea47760..a25eb8daf 100644 --- a/SConstruct +++ b/SConstruct @@ -398,6 +398,7 @@ pickle_store = [# Scons internal variables 'PLUGINS', 'ABI_VERSION', 'MAPNIK_VERSION_STRING', + 'MAPNIK_VERSION', 'PLATFORM', 'BOOST_ABI', 'BOOST_APPEND', @@ -1535,8 +1536,10 @@ if not preconfigured: color_print(1,'Problem encountered parsing mapnik version, falling back to %s' % abi_fallback) abi = abi_fallback - env['ABI_VERSION'] = abi.replace('-pre','').split('.') + abi_no_pre = abi.replace('-pre','').split('.') + env['ABI_VERSION'] = abi_no_pre env['MAPNIK_VERSION_STRING'] = abi + env['MAPNIK_VERSION'] = str(int(abi_no_pre[0])*100000+int(abi_no_pre[1])*100+int(abi_no_pre[2])) # Common DEFINES. env.Append(CPPDEFINES = '-D%s' % env['PLATFORM'].upper()) diff --git a/utils/mapnik-config/build.py b/utils/mapnik-config/build.py index bd42c1024..deef156a7 100644 --- a/utils/mapnik-config/build.py +++ b/utils/mapnik-config/build.py @@ -9,16 +9,13 @@ Import('env') config_env = env.Clone() -# TODO -# major/minor versions -# git rev-list --max-count=1 HEAD - config_variables = '''#!/bin/sh ## variables CONFIG_PREFIX="$( cd "$( dirname $( dirname "$0" ))" && pwd )" +CONFIG_MAPNIK_VERSION_STRING='%(version_string)s' CONFIG_MAPNIK_VERSION='%(version)s' CONFIG_GIT_REVISION='%(git_revision)s' CONFIG_GIT_DESCRIBE='%(git_describe)s' @@ -99,7 +96,8 @@ lib_path = "${CONFIG_PREFIX}/" + config_env['LIBDIR_SCHEMA'] configuration = { "git_revision": git_revision, "git_describe": git_describe, - "version": config_env['MAPNIK_VERSION_STRING'], + "version_string": config_env['MAPNIK_VERSION_STRING'], + "version": config_env['MAPNIK_VERSION'], "mapnik_libname": 'mapnik', "mapnik_libpath": lib_path, "ldflags": ldflags, diff --git a/utils/mapnik-config/mapnik-config.template.sh b/utils/mapnik-config/mapnik-config.template.sh index df1ea69ee..7e1237cff 100755 --- a/utils/mapnik-config/mapnik-config.template.sh +++ b/utils/mapnik-config/mapnik-config.template.sh @@ -9,7 +9,8 @@ Usage: mapnik-config [OPTION] Known values for OPTION are: -h --help display this help and exit - -v --version version information + -v --version version information (MAPNIK_VERSION_STRING) + --version-number version number (MAPNIK_VERSION) --git-revision git hash from "git rev-list --max-count=1 HEAD" --git-describe git decribe output (new in 2.2.x) --fonts default fonts directory @@ -52,11 +53,15 @@ while test $# -gt 0; do ;; -v) - echo ${CONFIG_MAPNIK_VERSION} + echo ${CONFIG_MAPNIK_VERSION_STRING} ;; --version) - echo $CONFIG_MAPNIK_VERSION + echo ${CONFIG_MAPNIK_VERSION_STRING} + ;; + + --version-number) + echo ${CONFIG_MAPNIK_VERSION} ;; --git-revision)