[python-mapnik] 01/04: Imported Upstream version 0.0~20160531-f65767a

Bas Couwenberg sebastic at debian.org
Sun Jun 26 22:33:11 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository python-mapnik.

commit 9384a7426c12cf5816268d20cb77391728397892
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sun Jun 26 23:07:48 2016 +0200

    Imported Upstream version 0.0~20160531-f65767a
---
 mapnik/__init__.py                        | 14 +++++++-------
 setup.py                                  |  1 +
 src/mapnik_datasource.cpp                 |  1 -
 src/mapnik_feature.cpp                    |  1 -
 src/mapnik_featureset.cpp                 |  1 -
 src/mapnik_geometry.cpp                   |  1 -
 src/mapnik_image.cpp                      |  5 ++++-
 src/mapnik_python.cpp                     |  5 +++++
 test/python_tests/geojson_plugin_test.py  | 10 +++++-----
 test/python_tests/topojson_plugin_test.py | 26 ++++++++++++++------------
 10 files changed, 36 insertions(+), 29 deletions(-)

diff --git a/mapnik/__init__.py b/mapnik/__init__.py
index 5df6b33..9892532 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/setup.py b/setup.py
index fc592ef..075a8f0 100755
--- a/setup.py
+++ b/setup.py
@@ -112,6 +112,7 @@ else:
 
 linkflags = []
 lib_path = os.path.join(check_output([mapnik_config, '--prefix']),'lib')
+linkflags.extend(check_output([mapnik_config, '--libs']).split(' '))
 linkflags.extend(check_output([mapnik_config, '--ldflags']).split(' '))
 linkflags.extend(check_output([mapnik_config, '--dep-libs']).split(' '))
 linkflags.extend([
diff --git a/src/mapnik_datasource.cpp b/src/mapnik_datasource.cpp
index bde9143..c0b2749 100644
--- a/src/mapnik_datasource.cpp
+++ b/src/mapnik_datasource.cpp
@@ -195,7 +195,6 @@ void export_datasource()
              "These vary depending on the type of data source.")
         .def(self == self)
         ;
-    register_ptr_to_python<std::shared_ptr<datasource> >();
 
     def("CreateDatasource",&create_datasource);
 
diff --git a/src/mapnik_feature.cpp b/src/mapnik_feature.cpp
index b479db3..e8f1fbc 100644
--- a/src/mapnik_feature.cpp
+++ b/src/mapnik_feature.cpp
@@ -230,5 +230,4 @@ void export_feature()
         .def("from_geojson",from_geojson_impl)
         .staticmethod("from_geojson")
         ;
-    register_ptr_to_python<std::shared_ptr<mapnik::feature_impl> >();
 }
diff --git a/src/mapnik_featureset.cpp b/src/mapnik_featureset.cpp
index 9d034d4..70f9f79 100644
--- a/src/mapnik_featureset.cpp
+++ b/src/mapnik_featureset.cpp
@@ -86,5 +86,4 @@ void export_featureset()
                       "<mapnik.Feature object at 0x105e64140>\n"
             )
         ;
-    register_ptr_to_python<std::shared_ptr<mapnik::Featureset> >();
 }
diff --git a/src/mapnik_geometry.cpp b/src/mapnik_geometry.cpp
index 624e612..1181c06 100644
--- a/src/mapnik_geometry.cpp
+++ b/src/mapnik_geometry.cpp
@@ -282,5 +282,4 @@ void export_geometry()
         //.def("to_svg",&to_svg)
         // TODO add other geometry_type methods
         ;
-    register_ptr_to_python<std::shared_ptr<geometry<double>> >();
 }
diff --git a/src/mapnik_image.cpp b/src/mapnik_image.cpp
index 53244b2..80aebcb 100644
--- a/src/mapnik_image.cpp
+++ b/src/mapnik_image.cpp
@@ -43,7 +43,11 @@
 #if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO)
 #include <mapnik/cairo/cairo_context.hpp>
 #include <mapnik/cairo/cairo_image_util.hpp>
+#if PY_MAJOR_VERSION >= 3
+#include <py3cairo.h>
+#else
 #include <pycairo.h>
+#endif
 #include <cairo.h>
 #endif
 
@@ -463,6 +467,5 @@ void export_image()
         .staticmethod("from_cairo")
 #endif
         ;
-    register_ptr_to_python<std::shared_ptr<image_any> >();
 
 }
diff --git a/src/mapnik_python.cpp b/src/mapnik_python.cpp
index c937628..4c09213 100644
--- a/src/mapnik_python.cpp
+++ b/src/mapnik_python.cpp
@@ -142,8 +142,13 @@ void clear_cache()
 #if defined(HAVE_PYCAIRO)
 #include <boost/python/type_id.hpp>
 #include <boost/python/converter/registry.hpp>
+#if PY_MAJOR_VERSION >= 3
+#include <py3cairo.h>
+#else
 #include <pycairo.h>
 static Pycairo_CAPI_t *Pycairo_CAPI;
+#endif
+
 static void *extract_surface(PyObject* op)
 {
     if (PyObject_TypeCheck(op, const_cast<PyTypeObject*>(Pycairo_CAPI->Surface_Type)))
diff --git a/test/python_tests/geojson_plugin_test.py b/test/python_tests/geojson_plugin_test.py
index e68b9eb..8a41780 100644
--- a/test/python_tests/geojson_plugin_test.py
+++ b/test/python_tests/geojson_plugin_test.py
@@ -32,7 +32,7 @@ if 'geojson' in mapnik.DatasourceCache.plugin_names():
             type='geojson',
             file='../data/json/escaped.geojson')
         f = ds.features_at_point(ds.envelope().center()).features[0]
-        eq_(len(ds.fields()), 7)
+        eq_(len(ds.fields()), 11)
         desc = ds.describe()
         eq_(desc['geometry_type'], mapnik.DataGeometryType.Point)
 
@@ -49,7 +49,7 @@ if 'geojson' in mapnik.DatasourceCache.plugin_names():
             type='geojson',
             file='../data/json/escaped.geojson')
         f = ds.all_features()[0]
-        eq_(len(ds.fields()), 7)
+        eq_(len(ds.fields()), 11)
 
         desc = ds.describe()
         eq_(desc['geometry_type'], mapnik.DataGeometryType.Point)
@@ -69,7 +69,7 @@ if 'geojson' in mapnik.DatasourceCache.plugin_names():
             file='../data/json/escaped.geojson',
             cache_features=False)
         f = ds.features_at_point(ds.envelope().center()).features[0]
-        eq_(len(ds.fields()), 7)
+        eq_(len(ds.fields()), 11)
         desc = ds.describe()
         eq_(desc['geometry_type'], mapnik.DataGeometryType.Point)
 
@@ -86,7 +86,7 @@ if 'geojson' in mapnik.DatasourceCache.plugin_names():
             type='geojson',
             file='../data/json/escaped.geojson')
         f = ds.all_features()[0]
-        eq_(len(ds.fields()), 7)
+        eq_(len(ds.fields()), 11)
 
         desc = ds.describe()
         eq_(desc['geometry_type'], mapnik.DataGeometryType.Point)
@@ -118,7 +118,7 @@ if 'geojson' in mapnik.DatasourceCache.plugin_names():
         ds = mapnik.Datasource(
             type='geojson',
             file='../data/json/escaped.geojson')
-        eq_(len(ds.fields()), 7)
+        eq_(len(ds.fields()), 11)
         # TODO - this sorting is messed up
         #eq_(ds.fields(),['name', 'int', 'double', 'description', 'boolean', 'NOM_FR'])
         #eq_(ds.field_types(),['str', 'int', 'float', 'str', 'bool', 'str'])
diff --git a/test/python_tests/topojson_plugin_test.py b/test/python_tests/topojson_plugin_test.py
index 7560fbb..894a6d0 100644
--- a/test/python_tests/topojson_plugin_test.py
+++ b/test/python_tests/topojson_plugin_test.py
@@ -19,11 +19,11 @@ def setup():
 if 'topojson' in mapnik.DatasourceCache.plugin_names():
 
     def test_topojson_init():
-        # topojson tests/data/json/escaped.geojson -o tests/data/json/escaped.topojson --properties
+        # topojson tests/data/json/escaped.geojson -o tests/data/topojson/escaped.topojson --properties
         # topojson version 1.4.2
         ds = mapnik.Datasource(
             type='topojson',
-            file='../data/json/escaped.topojson')
+            file='../data/topojson/escaped.topojson')
         e = ds.envelope()
         assert_almost_equal(e.minx, -81.705583, places=7)
         assert_almost_equal(e.miny, 41.480573, places=6)
@@ -33,9 +33,9 @@ if 'topojson' in mapnik.DatasourceCache.plugin_names():
     def test_topojson_properties():
         ds = mapnik.Datasource(
             type='topojson',
-            file='../data/json/escaped.topojson')
+            file='../data/topojson/escaped.topojson')
         f = ds.features_at_point(ds.envelope().center()).features[0]
-        eq_(len(ds.fields()), 7)
+        eq_(len(ds.fields()), 11)
         desc = ds.describe()
         eq_(desc['geometry_type'], mapnik.DataGeometryType.Point)
 
@@ -50,9 +50,9 @@ if 'topojson' in mapnik.DatasourceCache.plugin_names():
 
         ds = mapnik.Datasource(
             type='topojson',
-            file='../data/json/escaped.topojson')
+            file='../data/topojson/escaped.topojson')
         f = ds.all_features()[0]
-        eq_(len(ds.fields()), 7)
+        eq_(len(ds.fields()), 11)
 
         desc = ds.describe()
         eq_(desc['geometry_type'], mapnik.DataGeometryType.Point)
@@ -70,10 +70,10 @@ if 'topojson' in mapnik.DatasourceCache.plugin_names():
         ds = mapnik.Datasource(
             type='topojson',
             inline=open(
-                '../data/json/escaped.topojson',
+                '../data/topojson/escaped.topojson',
                 'r').read())
         f = ds.all_features()[0]
-        eq_(len(ds.fields()), 7)
+        eq_(len(ds.fields()), 11)
 
         desc = ds.describe()
         eq_(desc['geometry_type'], mapnik.DataGeometryType.Point)
@@ -91,13 +91,15 @@ if 'topojson' in mapnik.DatasourceCache.plugin_names():
     def test_that_nonexistant_query_field_throws(**kwargs):
         ds = mapnik.Datasource(
             type='topojson',
-            file='../data/json/escaped.topojson')
-        eq_(len(ds.fields()), 7)
+            file='../data/topojson/escaped.topojson')
+        eq_(len(ds.fields()), 11)
         # TODO - this sorting is messed up
         eq_(ds.fields(), ['name', 'int', 'description',
-                          'spaces', 'double', 'boolean', 'NOM_FR'])
+                          'spaces', 'double', 'boolean', 'NOM_FR',
+                          'object', 'array', 'empty_array', 'empty_object'])
         eq_(ds.field_types(), ['str', 'int',
-                               'str', 'str', 'float', 'bool', 'str'])
+                               'str', 'str', 'float', 'bool', 'str',
+                               'str', 'str', 'str', 'str'])
 # TODO - should topojson plugin throw like others?
 #        query = mapnik.Query(ds.envelope())
 #        for fld in ds.fields():

-- 
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