[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#861905: marked as done (unblock: pyosmium/2.11.1-1)



Your message dated Sat, 06 May 2017 19:07:00 +0000
with message-id <c17d6e9f-2803-1711-4f69-a25ec242f3d8@thykier.net>
and subject line Re: Bug#861905: unblock: pyosmium/2.11.1-1
has caused the Debian Bug report #861905,
regarding unblock: pyosmium/2.11.1-1
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
861905: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=861905
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package pyosmium

Upstream has only fixed bugs for this release in line with the freeze
policy.

unblock pyosmium/2.11.1-1

Kind Regards,

Bas
diff -Nru pyosmium-2.11.0/CHANGELOG.md pyosmium-2.11.1/CHANGELOG.md
--- pyosmium-2.11.0/CHANGELOG.md	2017-01-15 15:39:17.000000000 +0100
+++ pyosmium-2.11.1/CHANGELOG.md	2017-05-04 23:36:03.000000000 +0200
@@ -13,6 +13,19 @@
 ### Fixed
 
 
+## [2.11.1] - 2017-05-04
+
+### Added
+
+### Changed
+
+### Fixed
+
+- prevent unnecessary calls to callbacks
+- correctly throw KeyError in taglist accessor
+- fix output type of index.map_types() function
+- don't overgrow writer buffers over requested size
+
 ## [2.11.0] - 2017-01-15
 
 ### Changed
@@ -123,7 +136,8 @@
 
 - Exception not caught in test.
 
-[unreleased]: https://github.com/osmcode/pyosmium/compare/v2.11.0...HEAD
+[unreleased]: https://github.com/osmcode/pyosmium/compare/v2.11.1...HEAD
+[2.11.1]: https://github.com/osmcode/pyosmium/compare/v2.11.0...v2.11.1
 [2.11.0]: https://github.com/osmcode/pyosmium/compare/v2.10.2...v2.11.0
 [2.10.2]: https://github.com/osmcode/pyosmium/compare/v2.9.0...v2.10.2
 [2.9.0]: https://github.com/osmcode/pyosmium/compare/v2.8.0...v2.9.0
diff -Nru pyosmium-2.11.0/debian/changelog pyosmium-2.11.1/debian/changelog
--- pyosmium-2.11.0/debian/changelog	2017-01-17 18:45:04.000000000 +0100
+++ pyosmium-2.11.1/debian/changelog	2017-05-05 09:51:21.000000000 +0200
@@ -1,3 +1,15 @@
+pyosmium (2.11.1-1) unstable; urgency=medium
+
+  * New upstream bugfix release.
+    - Prevent unnecessary calls to callbacks
+    - Correctly throw KeyError in taglist accessor
+    - Fix output type of index.map_types() function
+    - Don't overgrow writer buffers over requested size
+  * Update branch in gbp.conf & Vcs-Git URL.
+  * Limit watch file to 2.11.x releases.
+
+ -- Bas Couwenberg <sebastic@debian.org>  Fri, 05 May 2017 09:51:21 +0200
+
 pyosmium (2.11.0-1) unstable; urgency=medium
 
   * Move from experimental to unstable.
diff -Nru pyosmium-2.11.0/debian/control pyosmium-2.11.1/debian/control
--- pyosmium-2.11.0/debian/control	2017-01-15 21:46:51.000000000 +0100
+++ pyosmium-2.11.1/debian/control	2017-05-05 09:48:33.000000000 +0200
@@ -23,7 +23,7 @@
                zlib1g-dev
 Standards-Version: 3.9.8
 Vcs-Browser: https://anonscm.debian.org/cgit/pkg-grass/pyosmium.git/
-Vcs-Git: https://anonscm.debian.org/git/pkg-grass/pyosmium.git
+Vcs-Git: https://anonscm.debian.org/git/pkg-grass/pyosmium.git -b stretch
 Homepage: http://osmcode.org/pyosmium/
 
 Package: python-pyosmium
diff -Nru pyosmium-2.11.0/debian/gbp.conf pyosmium-2.11.1/debian/gbp.conf
--- pyosmium-2.11.0/debian/gbp.conf	2016-11-27 10:29:05.000000000 +0100
+++ pyosmium-2.11.1/debian/gbp.conf	2017-05-05 09:48:33.000000000 +0200
@@ -2,11 +2,11 @@
 
 # The default name for the upstream branch is "upstream".
 # Change it if the name is different (for instance, "master").
-upstream-branch = upstream
+upstream-branch = upstream-2.11
 
 # The default name for the Debian branch is "master".
 # Change it if the name is different (for instance, "debian/unstable").
-debian-branch = master
+debian-branch = stretch
 
 # git-import-orig uses the following names for the upstream tags.
 # Change the value if you are not using git-import-orig
diff -Nru pyosmium-2.11.0/debian/watch pyosmium-2.11.1/debian/watch
--- pyosmium-2.11.0/debian/watch	2016-10-26 21:36:51.000000000 +0200
+++ pyosmium-2.11.1/debian/watch	2017-05-05 09:48:33.000000000 +0200
@@ -4,4 +4,4 @@
 uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/,\
 filenamemangle=s/(?:.*\/)?(?:rel|v|pyosmium)[\-\_]?(\d[\d\-\.]+)\.(tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))/pyosmium-$1.$2/ \
 https://github.com/osmcode/pyosmium/releases \
-(?:.*/)?(?:rel|v|pyosmium)[\-\_]?(\d[\d\-\.]+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
+(?:.*/)?(?:rel|v|pyosmium)[\-\_]?(2\.11\.\d[\d\-\.]*)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
diff -Nru pyosmium-2.11.0/lib/generic_handler.hpp pyosmium-2.11.1/lib/generic_handler.hpp
--- pyosmium-2.11.0/lib/generic_handler.hpp	2017-01-15 15:39:17.000000000 +0100
+++ pyosmium-2.11.1/lib/generic_handler.hpp	2017-05-04 23:36:03.000000000 +0200
@@ -104,45 +104,46 @@
 struct SimpleHandlerWrap: BaseHandler, wrapper<BaseHandler> {
 
     void node(const osmium::Node& node) const {
-        if (override f = this->get_override("node"))
-            f(boost::ref(node));
-    }
+        if (!(m_callbacks & osmium::osm_entity_bits::node))
+            return;
 
-    void default_node(const osmium::Node&) const {
+        if (override f = this->get_override("node")) {
+            f(boost::ref(node));
+        }
     }
 
     void way(const osmium::Way& way) const {
+        if (!(m_callbacks & osmium::osm_entity_bits::way))
+            return;
+
         if (override f = this->get_override("way"))
             f(boost::ref(way));
     }
 
-    void default_way(const osmium::Way&) const {
-    }
-
     void relation(const osmium::Relation& rel) const {
+        if (!(m_callbacks & osmium::osm_entity_bits::relation))
+            return;
+
         if (override f = this->get_override("relation"))
             f(boost::ref(rel));
     }
 
-    void default_relation(const osmium::Relation&) const {
-    }
-
     void changeset(const osmium::Changeset& cs) const {
+        if (!(m_callbacks & osmium::osm_entity_bits::changeset))
+            return;
+
         if (override f = this->get_override("changeset"))
             f(boost::ref(cs));
     }
 
-    void default_changeset(const osmium::Changeset&) const {
-    }
-
     void area(const osmium::Area& area) const {
+        if (!(m_callbacks & osmium::osm_entity_bits::area))
+            return;
+
         if (override f = this->get_override("area"))
             f(boost::ref(area));
     }
 
-    void default_area(const osmium::Area&) const {
-    }
-
     void apply_file(const std::string &filename, bool locations = false,
                     const std::string &idx = "sparse_mem_array")
     {
@@ -155,7 +156,7 @@
     {
         Py_buffer pybuf;
         PyObject_GetBuffer(buf.ptr(), &pybuf, PyBUF_C_CONTIGUOUS);
-        size_t len = pybuf.len;
+        size_t len = (size_t) pybuf.len;
         const char *cbuf = reinterpret_cast<const char *>(pybuf.buf);
         const char *cfmt = boost::python::extract<const char *>(format);
 
@@ -170,24 +171,50 @@
                                             BaseHandler::location_handler
                                             :BaseHandler::no_handler;
 
-        if (this->get_override("area"))
+        m_callbacks = osmium::osm_entity_bits::nothing;
+        if (hasfunc("node"))
+            m_callbacks |= osmium::osm_entity_bits::node;
+        if (hasfunc("way"))
+            m_callbacks |= osmium::osm_entity_bits::way;
+        if (hasfunc("relation"))
+            m_callbacks |= osmium::osm_entity_bits::relation;
+        if (hasfunc("area"))
+            m_callbacks |= osmium::osm_entity_bits::area;
+        if (hasfunc("changeset"))
+            m_callbacks |= osmium::osm_entity_bits::changeset;
+
+        if (m_callbacks & osmium::osm_entity_bits::area)
         {
             entities = osmium::osm_entity_bits::object;
             handler = BaseHandler::area_handler;
         } else {
-            if (locations || this->get_override("node"))
+            if (locations || m_callbacks & osmium::osm_entity_bits::node)
                 entities |= osmium::osm_entity_bits::node;
-            if (this->get_override("way"))
+            if (m_callbacks & osmium::osm_entity_bits::way)
                 entities |= osmium::osm_entity_bits::way;
-            if (this->get_override("relation"))
+            if (m_callbacks & osmium::osm_entity_bits::relation)
                 entities |= osmium::osm_entity_bits::relation;
         }
 
-        if (this->get_override("changeset"))
+        if (m_callbacks & osmium::osm_entity_bits::changeset)
             entities |= osmium::osm_entity_bits::changeset;
 
         apply(file, entities, handler, idx);
     }
+
+    bool hasfunc(char const *name) {
+        reference_existing_object::apply<SimpleHandlerWrap*>::type converter;
+        PyObject* obj = converter( this );
+
+        if (PyObject_HasAttrString(obj, name)) {
+            auto o = boost::python::object(handle<>(obj));
+            return o.attr(name) != boost::python::object();
+        }
+
+        return false;
+    }
+
+    osmium::osm_entity_bits::type m_callbacks;
 };
 
 #endif
diff -Nru pyosmium-2.11.0/lib/generic_writer.hpp pyosmium-2.11.1/lib/generic_writer.hpp
--- pyosmium-2.11.0/lib/generic_writer.hpp	2017-01-15 15:39:17.000000000 +0100
+++ pyosmium-2.11.1/lib/generic_writer.hpp	2017-05-04 23:36:03.000000000 +0200
@@ -16,7 +16,9 @@
 public:
     SimpleWriterWrap(const char* filename, size_t bufsz=4096*1024)
     : writer(filename),
-      buffer(bufsz < 2*BUFFER_WRAP ? 2*BUFFER_WRAP : bufsz, osmium::memory::Buffer::auto_grow::yes)
+      buffer(bufsz < 2 * BUFFER_WRAP ? 2 * BUFFER_WRAP : bufsz,
+             osmium::memory::Buffer::auto_grow::yes),
+      buffer_size(buffer.capacity()) // same rounding to BUFFER_WRAP
     {}
 
     virtual ~SimpleWriterWrap()
@@ -261,8 +263,8 @@
     void flush_buffer() {
         buffer.commit();
 
-        if (buffer.committed() > buffer.capacity() - BUFFER_WRAP) {
-            osmium::memory::Buffer new_buffer(buffer.capacity(), osmium::memory::Buffer::auto_grow::yes);
+        if (buffer.committed() > buffer_size - BUFFER_WRAP) {
+            osmium::memory::Buffer new_buffer(buffer_size, osmium::memory::Buffer::auto_grow::yes);
             using std::swap;
             swap(buffer, new_buffer);
             writer(std::move(new_buffer));
@@ -271,6 +273,7 @@
 
     osmium::io::Writer writer;
     osmium::memory::Buffer buffer;
+    size_t buffer_size;
 };
 
 #endif // PYOSMIUM_GENERIC_WRITER_HPP
diff -Nru pyosmium-2.11.0/lib/index.cc pyosmium-2.11.1/lib/index.cc
--- pyosmium-2.11.0/lib/index.cc	2017-01-15 15:39:17.000000000 +0100
+++ pyosmium-2.11.1/lib/index.cc	2017-05-04 23:36:03.000000000 +0200
@@ -12,9 +12,14 @@
     return map_factory.create_map(config_string).release();
 }
 
-std::vector<std::string> map_types() {
+PyObject *map_types() {
     const auto& map_factory = osmium::index::MapFactory<osmium::unsigned_object_id_type, osmium::Location>::instance();
-    return map_factory.map_types();
+
+    boost::python::list* l = new boost::python::list();
+    for(auto const &e : map_factory.map_types())
+        (*l).append(e);
+
+    return l->ptr();
 }
 
 BOOST_PYTHON_MODULE(index)
diff -Nru pyosmium-2.11.0/lib/osm.cc pyosmium-2.11.1/lib/osm.cc
--- pyosmium-2.11.0/lib/osm.cc	2017-01-15 15:39:17.000000000 +0100
+++ pyosmium-2.11.1/lib/osm.cc	2017-05-04 23:36:03.000000000 +0200
@@ -9,11 +9,18 @@
 #include "std_pair.hpp"
 
 
-inline const char *get_tag_by_key(osmium::TagList const& obj, const char *value)
+inline const char *get_tag_by_key(osmium::TagList const& obj, const char *key)
 {
-    const char* v = obj.get_value_by_key(value);
-    if (!v)
+    if (!key) {
+        PyErr_SetString(PyExc_KeyError, "Key 'None' not allowed.");
+        boost::python::throw_error_already_set();
+    }
+
+    const char* v = obj.get_value_by_key(key);
+    if (!v) {
         PyErr_SetString(PyExc_KeyError, "No tag with that key.");
+        boost::python::throw_error_already_set();
+    }
     return v;
 }
 
diff -Nru pyosmium-2.11.0/lib/osmium.cc pyosmium-2.11.1/lib/osmium.cc
--- pyosmium-2.11.0/lib/osmium.cc	2017-01-15 15:39:17.000000000 +0100
+++ pyosmium-2.11.1/lib/osmium.cc	2017-05-04 23:36:03.000000000 +0200
@@ -66,28 +66,14 @@
     ;
 
     class_<SimpleHandlerWrap, boost::noncopyable>("SimpleHandler",
-        "The most generic of OSM data handlers. For each data type "
-        "a callback can be implemented where the object is processed. Note that "
+        "The most generic of OSM data handlers. Derive your data processor "
+        "from this class and implement callbacks for each object type you are "
+        "interested in. The following data types are recognised: \n"
+        " `node`, `way`, `relation`, `area` and `changeset`.\n "
+        "A callback takes exactly one parameter which is the object. Note that "
         "all objects that are handed into the handler are only readable and are "
         "only valid until the end of the callback is reached. Any data that "
         "should be retained must be copied into other data structures.")
-        .def("node", &BaseHandler::node, &SimpleHandlerWrap::default_node,
-             (arg("self"), arg("node")),
-             "Handler called for node objects.")
-        .def("way", &BaseHandler::way, &SimpleHandlerWrap::default_way,
-             (arg("self"), arg("way")),
-             "Handler called for way objects. If the geometry of the way is "
-             "needed then ``locations`` must be set to true when calling "
-             "apply_file.")
-        .def("relation", &BaseHandler::relation, &SimpleHandlerWrap::default_relation,
-             (arg("self"), arg("relation")),
-             "Handler called for relation objects.")
-        .def("changeset", &BaseHandler::changeset, &SimpleHandlerWrap::default_changeset,
-             (arg("self"), arg("changeset")),
-             "Handler called for changeset objects.")
-        .def("area", &BaseHandler::area, &SimpleHandlerWrap::default_area,
-             (arg("self"), arg("area")),
-             "Handler called for area objects.")
         .def("apply_file", &SimpleHandlerWrap::apply_file,
               (arg("self"), arg("filename"),
                arg("locations")=false, arg("idx")="sparse_mem_array"),
diff -Nru pyosmium-2.11.0/osmium/version.py pyosmium-2.11.1/osmium/version.py
--- pyosmium-2.11.0/osmium/version.py	2017-01-15 15:39:17.000000000 +0100
+++ pyosmium-2.11.1/osmium/version.py	2017-05-04 23:36:03.000000000 +0200
@@ -5,7 +5,7 @@
 # the major version
 pyosmium_major = '2.11'
 # current release (Pip version)
-pyosmium_release = '2.11.0'
+pyosmium_release = '2.11.1'
 
 # libosmium version shipped with the Pip release
-libosmium_version = '2.11.0'
+libosmium_version = '2.11.3'

--- End Message ---
--- Begin Message ---
Bas Couwenberg:
> Package: release.debian.org
> Severity: normal
> User: release.debian.org@packages.debian.org
> Usertags: unblock
> 
> Please unblock package pyosmium
> 
> Upstream has only fixed bugs for this release in line with the freeze
> policy.
> 
> unblock pyosmium/2.11.1-1
> 
> Kind Regards,
> 
> Bas
> 

Unblocked, thanks.

~Niels

--- End Message ---

Reply to: