diff --git a/SConstruct b/SConstruct index 3b7b8c7e5..8a7edbd9e 100644 --- a/SConstruct +++ b/SConstruct @@ -331,6 +331,7 @@ pickle_store = [# Scons internal variables 'PYTHON_SYS_PREFIX', 'COLOR_PRINT', 'HAS_BOOST_SYSTEM', + 'SVN_REVISION' ] # Add all other user configurable options to pickle pickle_store @@ -985,19 +986,12 @@ if not preconfigured: else : common_cxx_flags = '-D%s ' % env['PLATFORM'].upper() - - - if not env['FAST']: - # if we are in SCons FAST mode then make to - # to avoid unnessary re-compiles due to changing - # CFLAGS when revision number increases - svn_version = call('svnversion') - if not svn_version == 'exported': - pattern = r'(\d+)(.*)' - try: - rev = re.match(pattern,svn_version).groups()[0] - common_cxx_flags += '-DSVN_REVISION=%s ' % rev - except: pass + svn_version = call('svnversion') + if not svn_version == 'exported': + pattern = r'(\d+)(.*)' + try: + env['SVN_REVISION'] = re.match(pattern,svn_version).groups()[0] + except: pass # Mac OSX (Darwin) special settings if env['PLATFORM'] == 'Darwin': diff --git a/bindings/python/SConscript b/bindings/python/SConscript index a5f3f74cf..4605a135a 100644 --- a/bindings/python/SConscript +++ b/bindings/python/SConscript @@ -137,6 +137,14 @@ env.Alias(target='install', source=ogcserver_module) # install the shared object beside the module directory -_mapnik = env.LoadableModule('mapnik/_mapnik2', glob.glob('*.cpp'), LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so', CPPPATH=headers,LINKFLAGS=linkflags) +sources = glob.glob('*.cpp') + +if env.get('SVN_REVISION'): + sources.remove('mapnik_python.cpp') + env2 = env.Clone(); + env2.Append(CCFLAGS='-DSVN_REVISION=%s' % env['SVN_REVISION']) + sources.insert(0,env2.Object('mapnik_python.cpp')) + +_mapnik = env.LoadableModule('mapnik/_mapnik2', sources, LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so', CPPPATH=headers,LINKFLAGS=linkflags) pymapniklib = env.Install(env['PYTHON_INSTALL_LOCATION'] + '/mapnik2',_mapnik) env.Alias(target='install',source=pymapniklib)