add mapnik version number reporting to mapnik-config

This commit is contained in:
Dane Springmeyer 2013-05-10 13:45:18 -07:00
parent 55519212f7
commit 101ea276d1
3 changed files with 15 additions and 9 deletions

View file

@ -398,6 +398,7 @@ pickle_store = [# Scons internal variables
'PLUGINS', 'PLUGINS',
'ABI_VERSION', 'ABI_VERSION',
'MAPNIK_VERSION_STRING', 'MAPNIK_VERSION_STRING',
'MAPNIK_VERSION',
'PLATFORM', 'PLATFORM',
'BOOST_ABI', 'BOOST_ABI',
'BOOST_APPEND', 'BOOST_APPEND',
@ -1535,8 +1536,10 @@ if not preconfigured:
color_print(1,'Problem encountered parsing mapnik version, falling back to %s' % abi_fallback) color_print(1,'Problem encountered parsing mapnik version, falling back to %s' % abi_fallback)
abi = 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_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. # Common DEFINES.
env.Append(CPPDEFINES = '-D%s' % env['PLATFORM'].upper()) env.Append(CPPDEFINES = '-D%s' % env['PLATFORM'].upper())

View file

@ -9,16 +9,13 @@ Import('env')
config_env = env.Clone() config_env = env.Clone()
# TODO
# major/minor versions
# git rev-list --max-count=1 HEAD
config_variables = '''#!/bin/sh config_variables = '''#!/bin/sh
## variables ## variables
CONFIG_PREFIX="$( cd "$( dirname $( dirname "$0" ))" && pwd )" CONFIG_PREFIX="$( cd "$( dirname $( dirname "$0" ))" && pwd )"
CONFIG_MAPNIK_VERSION_STRING='%(version_string)s'
CONFIG_MAPNIK_VERSION='%(version)s' CONFIG_MAPNIK_VERSION='%(version)s'
CONFIG_GIT_REVISION='%(git_revision)s' CONFIG_GIT_REVISION='%(git_revision)s'
CONFIG_GIT_DESCRIBE='%(git_describe)s' CONFIG_GIT_DESCRIBE='%(git_describe)s'
@ -99,7 +96,8 @@ lib_path = "${CONFIG_PREFIX}/" + config_env['LIBDIR_SCHEMA']
configuration = { configuration = {
"git_revision": git_revision, "git_revision": git_revision,
"git_describe": git_describe, "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_libname": 'mapnik',
"mapnik_libpath": lib_path, "mapnik_libpath": lib_path,
"ldflags": ldflags, "ldflags": ldflags,

View file

@ -9,7 +9,8 @@ Usage: mapnik-config [OPTION]
Known values for OPTION are: Known values for OPTION are:
-h --help display this help and exit -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-revision git hash from "git rev-list --max-count=1 HEAD"
--git-describe git decribe output (new in 2.2.x) --git-describe git decribe output (new in 2.2.x)
--fonts default fonts directory --fonts default fonts directory
@ -52,11 +53,15 @@ while test $# -gt 0; do
;; ;;
-v) -v)
echo ${CONFIG_MAPNIK_VERSION} echo ${CONFIG_MAPNIK_VERSION_STRING}
;; ;;
--version) --version)
echo $CONFIG_MAPNIK_VERSION echo ${CONFIG_MAPNIK_VERSION_STRING}
;;
--version-number)
echo ${CONFIG_MAPNIK_VERSION}
;; ;;
--git-revision) --git-revision)