[pyosmium] 02/07: Imported Upstream version 2.5.3

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Wed Nov 18 22:21:24 UTC 2015


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

sebastic pushed a commit to branch master
in repository pyosmium.

commit 4ec26825d5956af344077a65c7ee2b6af369d14b
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Wed Nov 18 22:48:19 2015 +0100

    Imported Upstream version 2.5.3
---
 CHANGELOG.md               | 10 +++++++-
 README.md                  |  3 +++
 doc/conf.py                |  4 ++--
 examples/amenity_list.py   |  2 +-
 examples/osm_diff_stats.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++
 examples/osm_file_stats.py |  2 +-
 examples/pub_names.py      |  2 +-
 examples/road_length.py    |  2 +-
 lib/geom.cc                |  2 +-
 setup.py                   |  2 +-
 test/test_io.py            |  8 +++----
 test/test_osm.py           |  2 +-
 12 files changed, 83 insertions(+), 14 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1624941..9188283 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
 ### Fixed
 
 
+## [2.5.3] - 2015-11-17
+
+### Changed
+
+- Use current libosmium
+
+
 ## [2.4.1] - 2015-08-31
 
 ### Changed
@@ -37,7 +44,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
 
 - Exception not caught in test.
 
-[unreleased]: https://github.com/osmcode/pyosmium/compare/v2.4.1...HEAD
+[unreleased]: https://github.com/osmcode/pyosmium/compare/v2.5.3...HEAD
+[2.5.3]: https://github.com/osmcode/pyosmium/compare/v2.4.1...v2.5.3
 [2.4.1]: https://github.com/osmcode/pyosmium/compare/v2.3.0...v2.4.1
 [2.3.0]: https://github.com/osmcode/pyosmium/compare/v2.2.0...v2.3.0
 [2.2.0]: https://github.com/osmcode/pyosmium/compare/v2.1.0...v2.2.0
diff --git a/README.md b/README.md
index 494dcc8..11fa29a 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,9 @@ Python >= 2.7 is supported (that includes python 3.x).
 pyosmium uses [Boost.Python](http://www.boost.org/doc/libs/1_56_0/libs/python/doc/index.html)
 to create the bindings. On Debian/Ubuntu install `libboost-python-dev`.
 
+You have to compile with the same compiler version python is compiled with on
+your system, otherwise it might not work.
+
 
 ## Installation
 
diff --git a/doc/conf.py b/doc/conf.py
index de2cb6c..31ad351 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -63,9 +63,9 @@ copyright = '2015, Sarah Hoffmann'
 # built documents.
 #
 # The short X.Y version.
-version = '2.4'
+version = '2.5'
 # The full version, including alpha/beta/rc tags.
-release = '2.4.1'
+release = '2.5.3'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/examples/amenity_list.py b/examples/amenity_list.py
index 3921cf9..f3be92d 100644
--- a/examples/amenity_list.py
+++ b/examples/amenity_list.py
@@ -31,7 +31,7 @@ class AmenityListHandler(o.SimpleHandler):
 
 if __name__ == '__main__':
     if len(sys.argv) != 2:
-        print "Usage: python amenity_list.py <osmfile>"
+        print("Usage: python amenity_list.py <osmfile>")
         sys.exit(-1)
 
     handler = AmenityListHandler()
diff --git a/examples/osm_diff_stats.py b/examples/osm_diff_stats.py
new file mode 100644
index 0000000..aeab6d8
--- /dev/null
+++ b/examples/osm_diff_stats.py
@@ -0,0 +1,58 @@
+"""
+Simple example that counts the number of changes in an osm diff file.
+
+Shows how to detect the different kind of modifications.
+"""
+import osmium as o
+import sys
+
+class Stats(object):
+
+    def __init__(self):
+        self.added = 0
+        self.modified = 0
+        self.deleted = 0
+
+    def add(self, o):
+        if o.deleted:
+            self.deleted += 1
+        elif o.version == 1:
+            self.added += 1
+        else:
+            self.modified += 1
+
+
+    def outstats(self, prefix):
+        print("%s added: %d" % (prefix, self.added))
+        print("%s modified: %d" % (prefix, self.modified))
+        print("%s deleted: %d" % (prefix, self.deleted))
+
+class FileStatsHandler(o.SimpleHandler):
+    def __init__(self):
+        o.SimpleHandler.__init__(self)
+        self.nodes = Stats()
+        self.ways = Stats()
+        self.rels = Stats()
+
+    def node(self, n):
+        self.nodes.add(n)
+
+    def way(self, w):
+        self.ways.add(w)
+
+    def relation(self, r):
+        self.rels.add(r)
+
+
+if __name__ == '__main__':
+    if len(sys.argv) != 2:
+        print("Usage: python osm_file_stats.py <osmfile>")
+        sys.exit(-1)
+
+    h = FileStatsHandler()
+
+    h.apply_file(sys.argv[1])
+
+    h.nodes.outstats("Nodes")
+    h.ways.outstats("Ways")
+    h.rels.outstats("Relations")
diff --git a/examples/osm_file_stats.py b/examples/osm_file_stats.py
index 52ea56c..2482243 100644
--- a/examples/osm_file_stats.py
+++ b/examples/osm_file_stats.py
@@ -25,7 +25,7 @@ class FileStatsHandler(o.SimpleHandler):
 
 if __name__ == '__main__':
     if len(sys.argv) != 2:
-        print "Usage: python osm_file_stats.py <osmfile>"
+        print("Usage: python osm_file_stats.py <osmfile>")
         sys.exit(-1)
 
     h = FileStatsHandler()
diff --git a/examples/pub_names.py b/examples/pub_names.py
index b71c050..4066d8f 100644
--- a/examples/pub_names.py
+++ b/examples/pub_names.py
@@ -19,7 +19,7 @@ class NamesHandler(osmium.SimpleHandler):
 
 if __name__ == '__main__':
     if len(sys.argv) != 2:
-        print "Usage: python pub_names.py <osmfile>"
+        print("Usage: python pub_names.py <osmfile>")
         sys.exit(-1)
 
     h = NamesHandler()
diff --git a/examples/road_length.py b/examples/road_length.py
index b36cc3e..7b14d7e 100644
--- a/examples/road_length.py
+++ b/examples/road_length.py
@@ -22,7 +22,7 @@ class RoadLengthHandler(o.SimpleHandler):
 
 if __name__ == '__main__':
     if len(sys.argv) != 2:
-        print "Usage: python road_length.py <osmfile>"
+        print("Usage: python road_length.py <osmfile>")
         sys.exit(-1)
 
     h = RoadLengthHandler()
diff --git a/lib/geom.cc b/lib/geom.cc
index a650c39..1b17440 100644
--- a/lib/geom.cc
+++ b/lib/geom.cc
@@ -39,7 +39,7 @@ BOOST_PYTHON_MODULE(_geom)
                       "(read-only) EPSG number of the output geometry.")
         .add_property("proj_string", &WKBFactory::proj_string,
                       "(read-only) projection string of the output geometry.")
-        .def("create_point", static_cast<std::string (WKBFactory::*)(const osmium::Location) const>(&WKBFactory::create_point),
+        .def("create_point", static_cast<std::string (WKBFactory::*)(const osmium::Location&) const>(&WKBFactory::create_point),
              (arg("self"), arg("location")),
              "Create a point geometry from a :py:class:`osmium.osm.Location`.")
         .def("create_point", static_cast<std::string (WKBFactory::*)(const osmium::Node&)>(&WKBFactory::create_point),
diff --git a/setup.py b/setup.py
index ebf81bd..cd8ec12 100644
--- a/setup.py
+++ b/setup.py
@@ -61,7 +61,7 @@ for ext in ('io', 'osm', 'index', 'geom'):
 
 
 setup (name = 'pyosmium',
-       version = '2.4.1',
+       version = '2.5.3',
        description = 'Provides python bindings for libosmium.',
        packages = packages,
        ext_modules = extensions)
diff --git a/test/test_io.py b/test/test_io.py
index f9435d0..aef135b 100644
--- a/test/test_io.py
+++ b/test/test_io.py
@@ -18,23 +18,23 @@ class TestReaderFromFile(unittest.TestCase):
 
     def test_node_only(self):
         self._run_file(create_osm_file([osmobj('N', id=1)]))
-        
+
     def test_way_only(self):
         self._run_file(create_osm_file([osmobj('W', id=1, nodes=[1,2,3])]))
 
     def test_relation_only(self):
-        self._run_file(create_osm_file([osmobj('R', id=1, members=[('W', 1, '')])]))
+        self._run_file(create_osm_file([osmobj('R', id=1, members=[('way', 1, '')])]))
 
     def test_node_with_tags(self):
         self._run_file(create_osm_file([osmobj('N', id=1, 
                                                tags=dict(foo='bar', name='xx'))]))
-        
+
     def test_way_with_tags(self):
         self._run_file(create_osm_file([osmobj('W', id=1, nodes=[1,2,3],
                                                tags=dict(foo='bar', name='xx'))]))
 
     def test_relation_with_tags(self):
-        self._run_file(create_osm_file([osmobj('R', id=1, members=[('W', 1, '')],
+        self._run_file(create_osm_file([osmobj('R', id=1, members=[('way', 1, '')],
                                                tags=dict(foo='bar', name='xx'))]))
 
     def test_broken_timestamp(self):
diff --git a/test/test_osm.py b/test/test_osm.py
index b8fc14c..0dd3fd6 100644
--- a/test/test_osm.py
+++ b/test/test_osm.py
@@ -76,7 +76,7 @@ class TestWayAttributes(HandlerTestBase, unittest.TestCase):
 class TestRelationAttributes(HandlerTestBase, unittest.TestCase):
     data = [osmobj('R', id=1, version=5, changeset=58674, uid=42,
                    timestamp='2014-01-31T06:23:35Z', user='anonymous',
-                   members=[('W',1,'')])]
+                   members=[('way',1,'')])]
 
     class Handler(o.SimpleHandler):
         def relation(self, n):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pyosmium.git



More information about the Pkg-grass-devel mailing list