From acb726ce639b50ad00d9fc233889d0cad9de1304 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Tue, 13 Dec 2011 17:53:31 -0800 Subject: [PATCH] serialize relative path to fonts/plugins in python paths.py and re-assemble absolute path dynamically at load time to provide greatest portability --- bindings/python/build.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bindings/python/build.py b/bindings/python/build.py index 2c4846cc3..f65ff69f1 100644 --- a/bindings/python/build.py +++ b/bindings/python/build.py @@ -43,7 +43,8 @@ prefix = env['PREFIX'] target_path = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik') target_path_deprecated = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik2') -libraries = ['mapnik','png'] +libraries = ['mapnik'] +libraries.append('png') if env['JPEG']: libraries.append('jpeg') @@ -122,22 +123,24 @@ else: paths = ''' """Configuration paths of Mapnik fonts and input plugins (auto-generated by SCons).""" -import os +from os.path import normpath,join,dirname mapniklibpath = '%s' +mapniklibpath = normpath(join(dirname(__file__),mapniklibpath)) ''' -paths += "inputpluginspath = os.path.normpath(mapniklibpath + '/input')\n" +paths += "inputpluginspath = join(mapniklibpath,'input')\n" if env['SYSTEM_FONTS']: - paths += "fontscollectionpath = os.path.normpath('%s')" % env['SYSTEM_FONTS'] + paths += "fontscollectionpath = normpath('%s')\n" % env['SYSTEM_FONTS'] else: - paths += "fontscollectionpath = os.path.normpath(mapniklibpath + '/fonts')" + paths += "fontscollectionpath = join(mapniklibpath,'fonts')\n" +paths += "__all__ = [mapniklibpath,inputpluginspath,fontscollectionpath]\n" if not os.path.exists('mapnik'): os.mkdir('mapnik') -file('mapnik/paths.py','w').write(paths % (env['MAPNIK_LIB_DIR'])) +file('mapnik/paths.py','w').write(paths % (os.path.relpath(env['MAPNIK_LIB_DIR'],target_path))) # force open perms temporarily so that `sudo scons install` # does not later break simple non-install non-sudo rebuild