diff --git a/SConstruct b/SConstruct index 5b10da417..71f04991d 100644 --- a/SConstruct +++ b/SConstruct @@ -768,7 +768,7 @@ def GetMapnikLibVersion(context): int main() { - std::cout << MAPNIK_VERSION << std::endl; + std::cout << MAPNIK_VERSION_STRING << std::endl; return 0; } @@ -778,11 +778,7 @@ int main() context.Result(ret[0]) if not ret[1]: return [] - version = int(ret[1].strip()) - patch_level = version % 100 - minor_version = version / 100 % 1000 - major_version = version / 100000 - return [major_version,minor_version,patch_level] + return ret[1].strip() def icu_at_least_four_two(context): ret = context.TryRun(""" @@ -1382,14 +1378,13 @@ if not preconfigured: # fetch the mapnik version header in order to set the # ABI version used to build libmapnik.so on linux in src/build.py abi = conf.GetMapnikLibVersion() - abi_fallback = [2,0,0] + abi_fallback = "2.0.1-pre" if not abi: color_print(1,'Problem encountered parsing mapnik version, falling back to %s' % abi_fallback) - env['ABI_VERSION'] = abi_fallback - else: - env['ABI_VERSION'] = abi - env['MAPNIK_VERSION_STRING'] = '.'.join(['%d' % i for i in env['ABI_VERSION']]) + abi = abi_fallback + env['ABI_VERSION'] = abi.replace('-pre','').split('.') + env['MAPNIK_VERSION_STRING'] = abi # Common C++ flags. if env['THREADING'] == 'multi': diff --git a/bindings/python/mapnik/__init__.py b/bindings/python/mapnik/__init__.py index 11129f80a..8cf54f1d9 100644 --- a/bindings/python/mapnik/__init__.py +++ b/bindings/python/mapnik/__init__.py @@ -572,13 +572,6 @@ def Geos(**keywords): keywords['type'] = 'geos' return CreateDatasource(keywords) -def mapnik_version_string(version=mapnik_version()): - """Return the Mapnik version as a string.""" - patch_level = version % 100 - minor_version = version / 100 % 1000 - major_version = version / 100000 - return '%s.%s.%s' % ( major_version, minor_version,patch_level) - def mapnik_version_from_string(version_string): """Return the Mapnik version from a string.""" n = version_string.split('.') diff --git a/bindings/python/mapnik_python.cpp b/bindings/python/mapnik_python.cpp index e0591977a..4a4f5c4c9 100644 --- a/bindings/python/mapnik_python.cpp +++ b/bindings/python/mapnik_python.cpp @@ -279,6 +279,11 @@ unsigned mapnik_version() return MAPNIK_VERSION; } +std::string mapnik_version_string() +{ + return MAPNIK_VERSION_STRING; +} + // indicator for jpeg read/write support within libmapnik bool has_jpeg() { @@ -573,6 +578,7 @@ BOOST_PYTHON_MODULE(_mapnik) def("save_map_to_string", &save_map_to_string, save_map_to_string_overloads()); def("mapnik_version", &mapnik_version,"Get the Mapnik version number"); + def("mapnik_version_string", &mapnik_version_string,"Get the Mapnik version string"); def("has_jpeg", &has_jpeg, "Get jpeg read/write support status"); def("has_cairo", &has_cairo, "Get cairo library status"); def("has_pycairo", &has_pycairo, "Get pycairo module status"); diff --git a/include/mapnik/version.hpp b/include/mapnik/version.hpp index b79c0f666..b5a96d8ea 100644 --- a/include/mapnik/version.hpp +++ b/include/mapnik/version.hpp @@ -23,6 +23,28 @@ #ifndef MAPNIK_VERSION_HPP #define MAPNIK_VERSION_HPP -#define MAPNIK_VERSION 200000 +#define MAPNIK_VERSION_IS_RELEASE 0 + +#define MAPNIK_MAJOR_VERSION 2 +#define MAPNIK_MINOR_VERSION 1 +#define MAPNIK_PATCH_VERSION 0 + +#define MAPNIK_VERSION (MAPNIK_MAJOR_VERSION*100000) + (MAPNIK_MINOR_VERSION*100) + (MAPNIK_PATCH_VERSION) + +#ifndef MAPNIK_STRINGIFY +#define MAPNIK_STRINGIFY(n) MAPNIK_STRINGIFY_HELPER(n) +#define MAPNIK_STRINGIFY_HELPER(n) #n +#endif + +#if MAPNIK_VERSION_IS_RELEASE +# define MAPNIK_VERSION_STRING MAPNIK_STRINGIFY(MAPNIK_MAJOR_VERSION) "." \ + MAPNIK_STRINGIFY(MAPNIK_MINOR_VERSION) "." \ + MAPNIK_STRINGIFY(MAPNIK_PATCH_VERSION) + +#else +# define MAPNIK_VERSION_STRING MAPNIK_STRINGIFY(MAPNIK_MAJOR_VERSION) "." \ + MAPNIK_STRINGIFY(MAPNIK_MINOR_VERSION) "." \ + MAPNIK_STRINGIFY(MAPNIK_PATCH_VERSION) "-pre" +#endif #endif // MAPNIK_VERSION_HPP diff --git a/src/build.py b/src/build.py index 78df41b46..956b5d550 100644 --- a/src/build.py +++ b/src/build.py @@ -83,7 +83,7 @@ else: if env['PLATFORM'] == 'Darwin': mapnik_libname = 'libmapnik.dylib' else: - mapnik_libname = 'libmapnik.so.' + ("%d.%d" % (ABI_VERSION[0],ABI_VERSION[1])) + mapnik_libname = 'libmapnik.so.' + ("%d.%d" % (int(ABI_VERSION[0]),int(ABI_VERSION[1]))) if env['PLATFORM'] == 'Darwin': if env['FULL_LIB_PATH']: @@ -91,7 +91,7 @@ if env['PLATFORM'] == 'Darwin': else: lib_path = mapnik_libname mapnik_lib_link_flag += ' -Wl,-install_name,%s' % lib_path - _d = {'version':env['MAPNIK_VERSION_STRING']} + _d = {'version':env['MAPNIK_VERSION_STRING'].replace('-pre','')} mapnik_lib_link_flag += ' -current_version %(version)s -compatibility_version %(version)s' % _d elif env['PLATFORM'] == 'SunOS': if env['CXX'].startswith('CC'):