add a function to query for the svn revision of the mapnik python bindings

This commit is contained in:
Dane Springmeyer 2009-07-17 20:51:39 +00:00
parent 70527e7db2
commit 9ce6792eda
2 changed files with 20 additions and 0 deletions

View file

@ -824,12 +824,22 @@ 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':
pthread = ''

View file

@ -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;