From d58ee9e0f9486f751cbe71d94ab7f6a22ac026f0 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 22 Jul 2010 22:14:19 +0000 Subject: [PATCH] use SCons to build up the mapnik viewer ini file --- SConstruct | 3 +++ demo/viewer/SConscript | 47 ++++++++++++++++++++++++++++++++++++++++++ demo/viewer/viewer.ini | 5 ----- 3 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 demo/viewer/SConscript delete mode 100644 demo/viewer/viewer.ini diff --git a/SConstruct b/SConstruct index 21ba679ea..3633d9119 100644 --- a/SConstruct +++ b/SConstruct @@ -1274,3 +1274,6 @@ if not HELP_REQUESTED: # install pkg-config script and mapnik-config script SConscript('utils/mapnik-config/SConscript') + + # write the viewer.ini file + SConscript('demo/viewer/SConscript') diff --git a/demo/viewer/SConscript b/demo/viewer/SConscript new file mode 100644 index 000000000..5a93bb1a3 --- /dev/null +++ b/demo/viewer/SConscript @@ -0,0 +1,47 @@ +# +# This file is part of Mapnik (c++ mapping toolkit) +# +# Copyright (C) 2010 Artem Pavlenko, Jean-Francois Doyon +# +# Mapnik is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# $Id$ + +Import ('env') +import os +import platform + +lib_dir = os.path.normpath(env['DESTDIR'] + '/' + env['PREFIX'] + '/' + env['LIBDIR_SCHEMA'] + '/mapnik2') + +fonts = 1 +ini_template = ''' +[mapnik] +plugins_dir=%(lib_dir)s/input +fonts\1\dir=%(lib_dir)s/fonts +''' + +if platform.uname()[0] == 'Darwin': + ini_template += 'fonts\2\dir=/Library/Fonts\n' + fonts += 1 + +ini_template += 'fonts\size=%d\n' % fonts + +ini = ini_template % locals() + +open('viewer.ini','w').write(ini) + +try: + os.chmod(viewer.ini,0666) +except: pass diff --git a/demo/viewer/viewer.ini b/demo/viewer/viewer.ini deleted file mode 100644 index 054c8013e..000000000 --- a/demo/viewer/viewer.ini +++ /dev/null @@ -1,5 +0,0 @@ -[mapnik] -plugins_dir=/opt/mapnik/lib/mapnik2/input -fonts\1\dir=/opt/mapnik/lib/mapnik2/fonts -fonts\2\dir=/Library/Fonts -fonts\size=2