[python-mapnik] 01/05: Imported Upstream version 0.0~20151125-92e79d2
Sebastiaan Couwenberg
sebastic at moszumanska.debian.org
Fri Nov 27 01:15:22 UTC 2015
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository python-mapnik.
commit a1b75ed812eac23653a64ad153966b82ca8f8d0f
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Thu Nov 26 21:12:15 2015 +0100
Imported Upstream version 0.0~20151125-92e79d2
---
bootstrap.sh | 33 ++++++++--------
mapnik/__init__.py | 14 +++----
src/mapnik_geometry.cpp | 12 +++---
test/python_tests/multi_tile_raster_test.py | 32 +++++++--------
test/python_tests/pgraster_test.py | 61 ++++++++++++++++-------------
test/python_tests/postgis_test.py | 3 +-
6 files changed, 80 insertions(+), 75 deletions(-)
diff --git a/bootstrap.sh b/bootstrap.sh
index 3d207b6..003df5e 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -21,34 +21,33 @@ function install() {
fi
}
+ICU_VERSION="55.1"
+
function install_mason_deps() {
- install mapnik 3.0.0
- install protobuf 2.6.1
- install freetype 2.5.4
- install harfbuzz 2cd5323
+ install mapnik latest
+ install gdal 1.11.2
+ install boost 1.59.0
+ install boost_liball 1.59.0
+ install freetype 2.6
+ install harfbuzz 0.9.40
install jpeg_turbo 1.4.0
- install libxml2 2.9.2
- install libpng 1.6.16
+ install libpng 1.6.17
install webp 0.4.2
- install icu 54.1
+ install icu ${ICU_VERSION}
install proj 4.8.0
install libtiff 4.0.4beta
- install boost 1.57.0
- install boost_libsystem 1.57.0
- install boost_libthread 1.57.0
- install boost_libfilesystem 1.57.0
- install boost_libprogram_options 1.57.0
- install boost_libpython 1.57.0
- install boost_libregex 1.57.0
- install boost_libpython 1.57.0
+ install libpq 9.4.0
+ install sqlite 3.8.8.1
+ install expat 2.1.0
install pixman 0.32.6
- install cairo 1.12.18
+ install cairo 1.14.2
+ install protobuf 2.6.1
}
function setup_runtime_settings() {
local MASON_LINKED_ABS=$(pwd)/mason_packages/.link
export PROJ_LIB=${MASON_LINKED_ABS}/share/proj
- export ICU_DATA=${MASON_LINKED_ABS}/share/icu/54.1
+ export ICU_DATA=${MASON_LINKED_ABS}/share/icu/${ICU_VERSION}
export GDAL_DATA=${MASON_LINKED_ABS}/share/gdal
if [[ $(uname -s) == 'Darwin' ]]; then
export DYLD_LIBRARY_PATH=$(pwd)/mason_packages/.link/lib:${DYLD_LIBRARY_PATH}
diff --git a/mapnik/__init__.py b/mapnik/__init__.py
index 8c18496..8fea8de 100644
--- a/mapnik/__init__.py
+++ b/mapnik/__init__.py
@@ -110,7 +110,7 @@ class Envelope(Box2d):
Box2d.__init__(self, *args, **kwargs)
-class _Coord(Coord, _injector):
+class Coord(Coord, _injector):
"""
Represents a point with two coordinates (either lon/lat or x/y).
@@ -185,7 +185,7 @@ class _Coord(Coord, _injector):
return inverse_(self, projection)
-class _Box2d(Box2d, _injector):
+class Box2d(Box2d, _injector):
"""
Represents a spatial envelope (i.e. bounding box).
@@ -240,7 +240,7 @@ class _Box2d(Box2d, _injector):
return inverse_(self, projection)
-class _Projection(Projection, _injector):
+class Projection(Projection, _injector):
def __repr__(self):
return "Projection('%s')" % self.params()
@@ -268,15 +268,15 @@ class _Projection(Projection, _injector):
return inverse_(obj, self)
-class _Feature(Feature, _injector):
+class Feature(Feature, _injector):
__geo_interface__ = property(lambda self: json.loads(self.to_geojson()))
-class _Geometry(Geometry, _injector):
+class Geometry(Geometry, _injector):
__geo_interface__ = property(lambda self: json.loads(self.to_geojson()))
-class _Datasource(Datasource, _injector):
+class Datasource(Datasource, _injector):
def all_features(self, fields=None, variables={}):
query = Query(self.envelope())
@@ -295,7 +295,7 @@ class _Datasource(Datasource, _injector):
return self.features(query)
-class _Color(Color, _injector):
+class Color(Color, _injector):
def __repr__(self):
return "Color(R=%d,G=%d,B=%d,A=%d)" % (self.r, self.g, self.b, self.a)
diff --git a/src/mapnik_geometry.cpp b/src/mapnik_geometry.cpp
index f0306da..b051c72 100644
--- a/src/mapnik_geometry.cpp
+++ b/src/mapnik_geometry.cpp
@@ -153,8 +153,8 @@ mapnik::box2d<double> geometry_envelope_impl(mapnik::geometry::geometry<double>
return mapnik::geometry::envelope(geom);
}
-// only Boost >= 1.56 contains the is_valid and is_simple functions
-#if BOOST_VERSION >= 105600
+// Mapnik requires Boost >= 1.58 for the is_valid and is_simple functions
+#if BOOST_VERSION >= 105800
bool geometry_is_valid_impl(mapnik::geometry::geometry<double> const& geom)
{
return mapnik::geometry::is_valid(geom);
@@ -227,7 +227,7 @@ void export_geometry()
"Constructs a new Point object\n"))
.add_property("x", &point<double>::x, "X coordinate")
.add_property("y", &point<double>::y, "Y coordinate")
-#if BOOST_VERSION >= 105600
+#if BOOST_VERSION >= 105800
.def("is_valid", &geometry_is_valid_impl)
.def("is_simple", &geometry_is_simple_impl)
#endif
@@ -239,7 +239,7 @@ void export_geometry()
class_<line_string<double> >("LineString", init<>(
"Constructs a new LineString object\n"))
.def("add_coord", &line_string<double>::add_coord, "Adds coord")
-#if BOOST_VERSION >= 105600
+#if BOOST_VERSION >= 105800
.def("is_valid", &geometry_is_valid_impl)
.def("is_simple", &geometry_is_simple_impl)
#endif
@@ -258,7 +258,7 @@ void export_geometry()
.add_property("exterior_ring", &polygon<double>::exterior_ring , "Exterior ring")
.def("add_hole", &polygon_add_hole_impl, "Add interior ring")
.def("num_rings", polygon_set_exterior_impl, "Number of rings (at least 1)")
-#if BOOST_VERSION >= 105600
+#if BOOST_VERSION >= 105800
.def("is_valid", &geometry_is_valid_impl)
.def("is_simple", &geometry_is_simple_impl)
#endif
@@ -277,7 +277,7 @@ void export_geometry()
.staticmethod("from_wkb")
.def("__str__",&to_wkt_impl)
.def("type",&geometry_type_impl)
-#if BOOST_VERSION >= 105600
+#if BOOST_VERSION >= 105800
.def("is_valid", &geometry_is_valid_impl)
.def("is_simple", &geometry_is_simple_impl)
#endif
diff --git a/test/python_tests/multi_tile_raster_test.py b/test/python_tests/multi_tile_raster_test.py
index 9fc9963..6e131d4 100644
--- a/test/python_tests/multi_tile_raster_test.py
+++ b/test/python_tests/multi_tile_raster_test.py
@@ -46,28 +46,28 @@ def test_multi_tile_policy():
mapnik.render(_map, im)
# test green chunk
- eq_(im.view(0, 64, 1, 1).tostring(), '\x00\xff\x00\xff')
- eq_(im.view(127, 64, 1, 1).tostring(), '\x00\xff\x00\xff')
- eq_(im.view(0, 127, 1, 1).tostring(), '\x00\xff\x00\xff')
- eq_(im.view(127, 127, 1, 1).tostring(), '\x00\xff\x00\xff')
+ eq_(im.view(0, 64, 1, 1).tostring(), b'\x00\xff\x00\xff')
+ eq_(im.view(127, 64, 1, 1).tostring(), b'\x00\xff\x00\xff')
+ eq_(im.view(0, 127, 1, 1).tostring(), b'\x00\xff\x00\xff')
+ eq_(im.view(127, 127, 1, 1).tostring(), b'\x00\xff\x00\xff')
# test blue chunk
- eq_(im.view(128, 64, 1, 1).tostring(), '\x00\x00\xff\xff')
- eq_(im.view(255, 64, 1, 1).tostring(), '\x00\x00\xff\xff')
- eq_(im.view(128, 127, 1, 1).tostring(), '\x00\x00\xff\xff')
- eq_(im.view(255, 127, 1, 1).tostring(), '\x00\x00\xff\xff')
+ eq_(im.view(128, 64, 1, 1).tostring(), b'\x00\x00\xff\xff')
+ eq_(im.view(255, 64, 1, 1).tostring(), b'\x00\x00\xff\xff')
+ eq_(im.view(128, 127, 1, 1).tostring(), b'\x00\x00\xff\xff')
+ eq_(im.view(255, 127, 1, 1).tostring(), b'\x00\x00\xff\xff')
# test red chunk
- eq_(im.view(0, 128, 1, 1).tostring(), '\xff\x00\x00\xff')
- eq_(im.view(127, 128, 1, 1).tostring(), '\xff\x00\x00\xff')
- eq_(im.view(0, 191, 1, 1).tostring(), '\xff\x00\x00\xff')
- eq_(im.view(127, 191, 1, 1).tostring(), '\xff\x00\x00\xff')
+ eq_(im.view(0, 128, 1, 1).tostring(), b'\xff\x00\x00\xff')
+ eq_(im.view(127, 128, 1, 1).tostring(), b'\xff\x00\x00\xff')
+ eq_(im.view(0, 191, 1, 1).tostring(), b'\xff\x00\x00\xff')
+ eq_(im.view(127, 191, 1, 1).tostring(), b'\xff\x00\x00\xff')
# test magenta chunk
- eq_(im.view(128, 128, 1, 1).tostring(), '\xff\x00\xff\xff')
- eq_(im.view(255, 128, 1, 1).tostring(), '\xff\x00\xff\xff')
- eq_(im.view(128, 191, 1, 1).tostring(), '\xff\x00\xff\xff')
- eq_(im.view(255, 191, 1, 1).tostring(), '\xff\x00\xff\xff')
+ eq_(im.view(128, 128, 1, 1).tostring(), b'\xff\x00\xff\xff')
+ eq_(im.view(255, 128, 1, 1).tostring(), b'\xff\x00\xff\xff')
+ eq_(im.view(128, 191, 1, 1).tostring(), b'\xff\x00\xff\xff')
+ eq_(im.view(255, 191, 1, 1).tostring(), b'\xff\x00\xff\xff')
if __name__ == "__main__":
setup()
diff --git a/test/python_tests/pgraster_test.py b/test/python_tests/pgraster_test.py
index 61a6c60..47c71a6 100644
--- a/test/python_tests/pgraster_test.py
+++ b/test/python_tests/pgraster_test.py
@@ -33,6 +33,8 @@ def setup():
def call(cmd, silent=False):
stdin, stderr = Popen(cmd, shell=True, stdout=PIPE,
stderr=PIPE).communicate()
+ stdin = stdin.decode()
+ stderr = stderr.decode()
if not stderr:
return stdin.strip()
elif not silent and 'error' in stderr.lower() \
@@ -212,18 +214,18 @@ if 'pgraster' in mapnik.DatasourceCache.plugin_names() \
lap = time.time() - t0
log('T ' + str(lap) + ' -- ' + lbl + ' E:full')
# no data
- eq_(im.view(1, 1, 1, 1).tostring(), '\x00\x00\x00\x00')
- eq_(im.view(255, 255, 1, 1).tostring(), '\x00\x00\x00\x00')
- eq_(im.view(195, 116, 1, 1).tostring(), '\x00\x00\x00\x00')
+ eq_(im.view(1, 1, 1, 1).tostring(), b'\x00\x00\x00\x00')
+ eq_(im.view(255, 255, 1, 1).tostring(), b'\x00\x00\x00\x00')
+ eq_(im.view(195, 116, 1, 1).tostring(), b'\x00\x00\x00\x00')
# A0A0A0
- eq_(im.view(100, 120, 1, 1).tostring(), '\xa0\xa0\xa0\xff')
- eq_(im.view(75, 80, 1, 1).tostring(), '\xa0\xa0\xa0\xff')
+ eq_(im.view(100, 120, 1, 1).tostring(), b'\xa0\xa0\xa0\xff')
+ eq_(im.view(75, 80, 1, 1).tostring(), b'\xa0\xa0\xa0\xff')
# 808080
- eq_(im.view(74, 170, 1, 1).tostring(), '\x80\x80\x80\xff')
- eq_(im.view(30, 50, 1, 1).tostring(), '\x80\x80\x80\xff')
+ eq_(im.view(74, 170, 1, 1).tostring(), b'\x80\x80\x80\xff')
+ eq_(im.view(30, 50, 1, 1).tostring(), b'\x80\x80\x80\xff')
# 404040
- eq_(im.view(190, 70, 1, 1).tostring(), '\x40\x40\x40\xff')
- eq_(im.view(140, 170, 1, 1).tostring(), '\x40\x40\x40\xff')
+ eq_(im.view(190, 70, 1, 1).tostring(), b'\x40\x40\x40\xff')
+ eq_(im.view(140, 170, 1, 1).tostring(), b'\x40\x40\x40\xff')
# Now zoom over a portion of the env (1/10)
newenv = mapnik.Box2d(273663, 4024478, 330738, 4072303)
@@ -233,16 +235,16 @@ if 'pgraster' in mapnik.DatasourceCache.plugin_names() \
lap = time.time() - t0
log('T ' + str(lap) + ' -- ' + lbl + ' E:1/10')
# nodata
- eq_(hexlify(im.view(255, 255, 1, 1).tostring()), '00000000')
- eq_(hexlify(im.view(200, 254, 1, 1).tostring()), '00000000')
+ eq_(hexlify(im.view(255, 255, 1, 1).tostring()), b'00000000')
+ eq_(hexlify(im.view(200, 254, 1, 1).tostring()), b'00000000')
# A0A0A0
- eq_(hexlify(im.view(90, 232, 1, 1).tostring()), 'a0a0a0ff')
- eq_(hexlify(im.view(96, 245, 1, 1).tostring()), 'a0a0a0ff')
+ eq_(hexlify(im.view(90, 232, 1, 1).tostring()), b'a0a0a0ff')
+ eq_(hexlify(im.view(96, 245, 1, 1).tostring()), b'a0a0a0ff')
# 808080
- eq_(hexlify(im.view(1, 1, 1, 1).tostring()), '808080ff')
- eq_(hexlify(im.view(128, 128, 1, 1).tostring()), '808080ff')
+ eq_(hexlify(im.view(1, 1, 1, 1).tostring()), b'808080ff')
+ eq_(hexlify(im.view(128, 128, 1, 1).tostring()), b'808080ff')
# 404040
- eq_(hexlify(im.view(255, 0, 1, 1).tostring()), '404040ff')
+ eq_(hexlify(im.view(255, 0, 1, 1).tostring()), b'404040ff')
def _test_dataraster_16bsi(lbl, tilesize, constraint, overview):
import_raster(
@@ -319,12 +321,12 @@ if 'pgraster' in mapnik.DatasourceCache.plugin_names() \
lyr.name, lbl, overview, clip)
compare_images(expected, im)
# no data
- eq_(hexlify(im.view(3, 3, 1, 1).tostring()), '00000000')
- eq_(hexlify(im.view(250, 250, 1, 1).tostring()), '00000000')
+ eq_(hexlify(im.view(3, 3, 1, 1).tostring()), b'00000000')
+ eq_(hexlify(im.view(250, 250, 1, 1).tostring()), b'00000000')
# full opaque river color
- eq_(hexlify(im.view(175, 118, 1, 1).tostring()), 'b9d8f8ff')
+ eq_(hexlify(im.view(175, 118, 1, 1).tostring()), b'b9d8f8ff')
# half-transparent pixel
- pxstr = hexlify(im.view(122, 138, 1, 1).tostring())
+ pxstr = hexlify(im.view(122, 138, 1, 1).tostring()).decode()
apat = ".*(..)$"
match = re.match(apat, pxstr)
assert match, 'pixel ' + pxstr + ' does not match pattern ' + apat
@@ -344,12 +346,12 @@ if 'pgraster' in mapnik.DatasourceCache.plugin_names() \
lyr.name, lbl, overview, clip)
compare_images(expected, im)
# no data
- eq_(hexlify(im.view(255, 255, 1, 1).tostring()), '00000000')
- eq_(hexlify(im.view(200, 40, 1, 1).tostring()), '00000000')
+ eq_(hexlify(im.view(255, 255, 1, 1).tostring()), b'00000000')
+ eq_(hexlify(im.view(200, 40, 1, 1).tostring()), b'00000000')
# full opaque river color
- eq_(hexlify(im.view(100, 168, 1, 1).tostring()), 'b9d8f8ff')
+ eq_(hexlify(im.view(100, 168, 1, 1).tostring()), b'b9d8f8ff')
# half-transparent pixel
- pxstr = hexlify(im.view(122, 138, 1, 1).tostring())
+ pxstr = hexlify(im.view(122, 138, 1, 1).tostring()).decode()
apat = ".*(..)$"
match = re.match(apat, pxstr)
assert match, 'pixel ' + pxstr + ' does not match pattern ' + apat
@@ -502,7 +504,7 @@ if 'pgraster' in mapnik.DatasourceCache.plugin_names() \
# 13 | v | b | v |
# +---+---+---+
#
- val_a = value / 3
+ val_a = int(value / 3)
val_b = val_a * 2
sql = "(select 3 as i, " \
" ST_SetValues(" \
@@ -556,10 +558,13 @@ if 'pgraster' in mapnik.DatasourceCache.plugin_names() \
compare_images(expected, im)
h = format(value, '02x')
hex_v = h + h + h + 'ff'
+ hex_v = hex_v.encode()
h = format(val_a, '02x')
hex_a = h + h + h + 'ff'
+ hex_a = hex_a.encode()
h = format(val_b, '02x')
hex_b = h + h + h + 'ff'
+ hex_b = hex_b.encode()
eq_(hexlify(im.view(3, 3, 1, 1).tostring()), hex_v)
eq_(hexlify(im.view(8, 3, 1, 1).tostring()), hex_v)
eq_(hexlify(im.view(13, 3, 1, 1).tostring()), hex_v)
@@ -788,9 +793,9 @@ if 'pgraster' in mapnik.DatasourceCache.plugin_names() \
expected = 'images/support/pgraster/%s-%s-%s-%s-%s-%s-%s-%s-%s.png' % (
lyr.name, lbl, pixtype, r, g, b, a, g1, b1)
compare_images(expected, im)
- hex_v = format(r << 24 | g << 16 | b << 8 | a, '08x')
- hex_a = format(r << 24 | g1 << 16 | b << 8 | a, '08x')
- hex_b = format(r << 24 | g << 16 | b1 << 8 | a, '08x')
+ hex_v = format(r << 24 | g << 16 | b << 8 | a, '08x').encode()
+ hex_a = format(r << 24 | g1 << 16 | b << 8 | a, '08x').encode()
+ hex_b = format(r << 24 | g << 16 | b1 << 8 | a, '08x').encode()
eq_(hexlify(im.view(3, 3, 1, 1).tostring()), hex_v)
eq_(hexlify(im.view(8, 3, 1, 1).tostring()), hex_v)
eq_(hexlify(im.view(13, 3, 1, 1).tostring()), hex_v)
diff --git a/test/python_tests/postgis_test.py b/test/python_tests/postgis_test.py
index 08dd5f7..bafda20 100644
--- a/test/python_tests/postgis_test.py
+++ b/test/python_tests/postgis_test.py
@@ -369,7 +369,8 @@ if 'postgis' in mapnik.DatasourceCache.plugin_names() \
geometry_field='geom',
user="rolethatdoesnotexist")
except Exception as e:
- assert 'role "rolethatdoesnotexist" does not exist' in str(e)
+ assert 'role "rolethatdoesnotexist" does not exist' in str(e) or \
+ 'authentication failed for user "rolethatdoesnotexist"' in str(e)
def test_empty_db():
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME, table='empty')
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/python-mapnik.git
More information about the Pkg-grass-devel
mailing list