diff --git a/SConstruct b/SConstruct index 7b3f57ba6..471b34bed 100644 --- a/SConstruct +++ b/SConstruct @@ -824,11 +824,21 @@ if not preconfigured: else: env['ABI_VERSION'] = abi + # Common C++ flags. if env['THREADING'] == 'multi' : common_cxx_flags = '-D%s -DBOOST_SPIRIT_THREADSAFE -DMAPNIK_THREADSAFE ' % env['PLATFORM'].upper() else : common_cxx_flags = '-D%s ' % env['PLATFORM'].upper() + + + svn_version = call('svnversion') + if svn_version == 'exported': + pattern = r'(\d+)(.*)' + try: + rev = re.match(pattern,svn_version).groups()[0] + common_cxx_flags += '-DSVN_REVISION=%s ' % rev + except: pass # Mac OSX (Darwin) special settings if env['PLATFORM'] == 'Darwin': diff --git a/bindings/python/mapnik_python.cpp b/bindings/python/mapnik_python.cpp index 7a8b227ec..ed01651f4 100644 --- a/bindings/python/mapnik_python.cpp +++ b/bindings/python/mapnik_python.cpp @@ -222,6 +222,15 @@ unsigned mapnik_version() return MAPNIK_VERSION; } +unsigned mapnik_svn_revision() +{ +#if defined(SVN_REVISION) + return SVN_REVISION; +#else + return 0; +#endif +} + bool has_cairo() { #if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO) @@ -434,6 +443,7 @@ BOOST_PYTHON_MODULE(_mapnik) */ def("mapnik_version", &mapnik_version,"Get the Mapnik version number"); + def("mapnik_svn_revision", &mapnik_svn_revision,"Get the Mapnik svn revision"); def("has_cairo", &has_cairo, "Get cairo library status"); using mapnik::symbolizer;