Skip to content

Commit b689670

Browse files
committed
switch back from mapnik2 to mapnik
add mapnik2 module which redirects to mapnik and issues DeprecationWarning
1 parent cfc05aa commit b689670

72 files changed

Lines changed: 697 additions & 666 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

SConstruct

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ opts.AddVariables(
377377
# Other variables
378378
BoolVariable('SHAPE_MEMORY_MAPPED_FILE', 'Utilize memory-mapped files in Shapefile Plugin (higher memory usage, better performance)', 'True'),
379379
('SYSTEM_FONTS','Provide location for python bindings to register fonts (if given aborts installation of bundled DejaVu fonts)',''),
380-
('LIB_DIR_NAME','Name to use for the subfolder beside libmapnik where fonts and plugins are installed','mapnik2'),
380+
('LIB_DIR_NAME','Name to use for the subfolder beside libmapnik where fonts and plugins are installed','mapnik'),
381381
PathVariable('PYTHON','Full path to Python executable used to build bindings', sys.executable),
382382
BoolVariable('FRAMEWORK_PYTHON', 'Link against Framework Python on Mac OS X', 'True'),
383383
BoolVariable('PYTHON_DYNAMIC_LOOKUP', 'On OSX, do not directly link python lib, but rather dynamically lookup symbols', 'True'),
@@ -1024,9 +1024,9 @@ if not preconfigured:
10241024
env['MAPNIK_FONTS_DEST'] = os.path.join(env['MAPNIK_LIB_DIR_DEST'],'fonts')
10251025

10261026
if env['LINKING'] == 'static':
1027-
env['MAPNIK_LIB_NAME'] = '${LIBPREFIX}mapnik2${LIBSUFFIX}'
1027+
env['MAPNIK_LIB_NAME'] = '${LIBPREFIX}mapnik${LIBSUFFIX}'
10281028
else:
1029-
env['MAPNIK_LIB_NAME'] = '${SHLIBPREFIX}mapnik2${SHLIBSUFFIX}'
1029+
env['MAPNIK_LIB_NAME'] = '${SHLIBPREFIX}mapnik${SHLIBSUFFIX}'
10301030

10311031
if env['PKG_CONFIG_PATH']:
10321032
env['ENV']['PKG_CONFIG_PATH'] = os.path.realpath(env['PKG_CONFIG_PATH'])
@@ -1752,7 +1752,7 @@ if not HELP_REQUESTED:
17521752
# Install the python speed testing scripts if python bindings will be available
17531753
SConscript('utils/performance/build.py')
17541754

1755-
# Install the mapnik2 upgrade script
1755+
# Install the mapnik upgrade script
17561756
SConscript('utils/upgrade_map_xml/build.py')
17571757

17581758
# Configure fonts and if requested install the bundled DejaVu fonts

bindings/python/build.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ def is_py3():
4040

4141

4242
prefix = env['PREFIX']
43-
target_path = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik2')
43+
target_path = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik')
4444

45-
libraries = ['mapnik2','png']
45+
libraries = ['mapnik','png']
4646

4747
if env['JPEG']:
4848
libraries.append('jpeg')
@@ -151,7 +151,11 @@ def is_py3():
151151
init_files.remove('mapnik/paths.py')
152152
init_module = env.Install(target_path, init_files)
153153
env.Alias(target='install', source=init_module)
154-
154+
# install mapnik2 module which redirects to mapnik and issues DeprecatedWarning
155+
path = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik2')
156+
init_mapnik2 = env.Install(path, 'mapnik2/__init__.py')
157+
env.Alias(target='install', source=init_mapnik2)
158+
155159
# fix perms and install the custom generated 'paths.py'
156160
if 'install' in COMMAND_LINE_TARGETS:
157161
targetp = os.path.join(target_path,'paths.py')
@@ -194,7 +198,7 @@ def is_py3():
194198
env2.Append(CXXFLAGS='-DSVN_REVISION=%s' % env['SVN_REVISION'])
195199
sources.insert(0,env2.SharedObject('mapnik_python.cpp'))
196200

197-
_mapnik = py_env.LoadableModule('mapnik/_mapnik2', sources, LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so',LINKFLAGS=linkflags)
201+
_mapnik = py_env.LoadableModule('mapnik/_mapnik', sources, LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so',LINKFLAGS=linkflags)
198202

199203
Depends(_mapnik, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))
200204

@@ -213,4 +217,4 @@ def is_py3():
213217

214218

215219
env['create_uninstall_target'](env, target_path)
216-
220+

bindings/python/mapnik/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
import sys
4444
import warnings
4545

46-
from _mapnik2 import *
46+
from _mapnik import *
4747
from paths import inputpluginspath, fontscollectionpath
4848

4949
import printing

bindings/python/mapnik/ogcserver/WMS.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from exceptions import OGCException, ServerConfigurationError
2626
from wms111 import ServiceHandler as ServiceHandler111
2727
from wms130 import ServiceHandler as ServiceHandler130
28-
from mapnik2 import Style, Map, load_map
28+
from mapnik import Style, Map, load_map
2929
import re
3030
import sys
3131

@@ -122,4 +122,4 @@ def finalize(self):
122122
for layer in self.layers.values():
123123
for style in list(layer.styles) + list(layer.wmsextrastyles):
124124
if style not in self.styles.keys() + self.aggregatestyles.keys():
125-
raise ServerConfigurationError('Layer "%s" refers to undefined style "%s".' % (layer.name, style))
125+
raise ServerConfigurationError('Layer "%s" refers to undefined style "%s".' % (layer.name, style))

bindings/python/mapnik/ogcserver/cgiserver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def process(self, req):
7474
if reqparams.has_key('service'):
7575
del reqparams['service']
7676
try:
77-
mapnikmodule = __import__('mapnik2.ogcserver.' + service)
77+
mapnikmodule = __import__('mapnik.ogcserver.' + service)
7878
except:
7979
raise OGCException('Unsupported service "%s".' % service)
8080
ServiceHandlerFactory = getattr(mapnikmodule.ogcserver, service).ServiceHandlerFactory
@@ -113,4 +113,4 @@ def lowerparams(params):
113113
reqparams = {}
114114
for key, value in params.items():
115115
reqparams[key.lower()] = value
116-
return reqparams
116+
return reqparams

bindings/python/mapnik/ogcserver/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"""Core OGCServer classes and functions."""
2323

2424
from exceptions import OGCException, ServerConfigurationError
25-
from mapnik2 import Map, Color, Box2d, render, Image, Layer, Style, Projection as MapnikProjection, Coord
25+
from mapnik import Map, Color, Box2d, render, Image, Layer, Style, Projection as MapnikProjection, Coord
2626
from PIL.Image import new
2727
from PIL.ImageDraw import Draw
2828
from StringIO import StringIO

bindings/python/mapnik/ogcserver/modserver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def __call__(self, apacheReq):
7878
if reqparams.has_key('service'):
7979
del reqparams['service']
8080
try:
81-
mapnikmodule = __import__('mapnik2.ogcserver.' + service)
81+
mapnikmodule = __import__('mapnik.ogcserver.' + service)
8282
except:
8383
raise OGCException('Unsupported service "%s".' % service)
8484
ServiceHandlerFactory = getattr(mapnikmodule.ogcserver, service).ServiceHandlerFactory

bindings/python/mapnik/ogcserver/wms111.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
ColorFactory, CRSFactory, WMSBaseServiceHandler, CRS, \
2626
BaseExceptionHandler, Projection
2727
from exceptions import OGCException, ServerConfigurationError
28-
from mapnik2 import Coord
28+
from mapnik import Coord
2929

3030
try:
3131
from lxml import etree as ElementTree

bindings/python/mapnik/ogcserver/wms130.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
ColorFactory, CRSFactory, CRS, WMSBaseServiceHandler, \
2626
BaseExceptionHandler, Projection, Box2d
2727
from exceptions import OGCException, ServerConfigurationError
28-
from mapnik2 import Coord
28+
from mapnik import Coord
2929

3030
try:
3131
from lxml import etree as ElementTree

bindings/python/mapnik/ogcserver/wsgi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def __call__(self, environ, start_response):
7272
if reqparams.has_key('service'):
7373
del reqparams['service']
7474
try:
75-
mapnikmodule = __import__('mapnik2.ogcserver.' + service)
75+
mapnikmodule = __import__('mapnik.ogcserver.' + service)
7676
except:
7777
raise OGCException('Unsupported service "%s".' % service)
7878
ServiceHandlerFactory = getattr(mapnikmodule.ogcserver, service).ServiceHandlerFactory
@@ -103,4 +103,4 @@ def __call__(self, environ, start_response):
103103
response_headers.append(('Cache-Control', max_age))
104104
start_response('200 OK', response_headers)
105105
yield response.content
106-
106+

0 commit comments

Comments
 (0)