serialize relative path to fonts/plugins in python paths.py and re-assemble absolute path dynamically at load time to provide greatest portability
This commit is contained in:
parent
61453b3842
commit
b45c0322b6
1 changed files with 9 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue