diff -Nru ros-genpy-0.5.7/CHANGELOG.rst ros-genpy-0.6.0/CHANGELOG.rst --- ros-genpy-0.5.7/CHANGELOG.rst 2015-11-09 23:36:57.000000000 +0000 +++ ros-genpy-0.6.0/CHANGELOG.rst 2016-04-22 02:08:02.000000000 +0000 @@ -2,6 +2,24 @@ Changelog for package genpy ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +0.6.0 (2016-04-21) +------------------ +* change semantic of integer division for duration (`#59 `_) + +0.5.9 (2016-04-19) +------------------ +* warn about using floor division of durations (`#58 `_) +* allow durations to be divided by other durations (`#48 `_) +* avoid adding newline in msg_generator (`#47 `_, `#51 `_) + +0.5.8 (2016-03-09) +------------------ + +* right align nsec fields of timestamps (`#45 `_) +* fix order of imports in generated init files deterministic (`#44 `_) +* fix exception handling code using undefined variable (`#42 `_) +* add test for expected exception when serializing wrong type + 0.5.7 (2015-11-09) ------------------ * add line about encoding to generated Python files (`#41 `_) diff -Nru ros-genpy-0.5.7/debian/changelog ros-genpy-0.6.0/debian/changelog --- ros-genpy-0.5.7/debian/changelog 2015-12-22 14:54:39.000000000 +0000 +++ ros-genpy-0.6.0/debian/changelog 2016-07-21 08:28:55.000000000 +0000 @@ -1,4 +1,31 @@ -ros-genpy (0.5.7-3~20151222) trusty; urgency=medium +ros-genpy (0.6.0-1~20160721) trusty; urgency=medium + + * Imported Upstream version 0.6.0 + * Remove Make-generated-__init__.py-files-reproduducible.patch, has been applied upstream + + -- Jochen Sprickerhof Sat, 18 Jun 2016 11:15:44 +0200 + +ros-genpy (0.5.7-6) unstable; urgency=medium + + * Adopt to new libexec location in catkin + + -- Jochen Sprickerhof Tue, 16 Feb 2016 10:30:01 +0100 + +ros-genpy (0.5.7-5) unstable; urgency=medium + + * Fix Descrition. + Thanks to Daniele Forsi (Closes: #812640) + + -- Jochen Sprickerhof Mon, 25 Jan 2016 20:16:47 +0100 + +ros-genpy (0.5.7-4) unstable; urgency=medium + + * Add patch for reproducible build. + Thanks to Chris Lamb for the patch (Closes: #808032) + + -- Jochen Sprickerhof Sat, 26 Dec 2015 14:14:09 +0100 + +ros-genpy (0.5.7-3) unstable; urgency=medium * Convert to new catkin with multiarch diff -Nru ros-genpy-0.5.7/debian/control ros-genpy-0.6.0/debian/control --- ros-genpy-0.5.7/debian/control 2015-12-17 22:50:36.000000000 +0000 +++ ros-genpy-0.6.0/debian/control 2016-07-07 08:10:52.000000000 +0000 @@ -6,7 +6,7 @@ Jochen Sprickerhof , Leopold Palomo-Avellaneda #python-yaml needed for tests only -Build-Depends: debhelper (>= 9), cmake, catkin (>> 0.6.16-2), python-genmsg, python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), dh-python, python-yaml +Build-Depends: debhelper (>= 9), cmake, catkin (>= 0.6.16-4), python-genmsg, python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), dh-python, python-yaml Standards-Version: 3.9.6 Homepage: http://wiki.ros.org/genpy Vcs-Browser: http://anonscm.debian.org/gitweb/?p=debian-science/packages/ros/ros-genpy.git @@ -18,5 +18,5 @@ Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}, python-genmsg Description: Python Robot OS message and service generators This package is part of Robot OS (ROS). genpy is a python program - that generates ROS messages and service code for Lisp. It lets you + that generates ROS messages and service code for Python. It lets you generate the code for your program from plain text files. diff -Nru ros-genpy-0.5.7/debian/python-genpy.install ros-genpy-0.6.0/debian/python-genpy.install --- ros-genpy-0.5.7/debian/python-genpy.install 2015-12-17 22:50:36.000000000 +0000 +++ ros-genpy-0.6.0/debian/python-genpy.install 2016-07-07 08:10:52.000000000 +0000 @@ -1,4 +1,4 @@ usr/share/genpy -usr/lib/*/genpy /usr/lib +usr/lib/genpy usr/lib/*/pkgconfig /usr/lib usr/etc/ros /etc diff -Nru ros-genpy-0.5.7/doc/conf.py ros-genpy-0.6.0/doc/conf.py --- ros-genpy-0.5.7/doc/conf.py 2015-11-09 23:36:57.000000000 +0000 +++ ros-genpy-0.6.0/doc/conf.py 2016-04-22 02:08:02.000000000 +0000 @@ -120,7 +120,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. diff -Nru ros-genpy-0.5.7/package.xml ros-genpy-0.6.0/package.xml --- ros-genpy-0.5.7/package.xml 2015-11-09 23:36:57.000000000 +0000 +++ ros-genpy-0.6.0/package.xml 2016-04-22 02:08:02.000000000 +0000 @@ -1,7 +1,7 @@ genpy - 0.5.7 + 0.6.0 Python ROS message and service generators. Dirk Thomas BSD diff -Nru ros-genpy-0.5.7/src/genpy/generate_initpy.py ros-genpy-0.6.0/src/genpy/generate_initpy.py --- ros-genpy-0.5.7/src/genpy/generate_initpy.py 2015-11-09 23:36:57.000000000 +0000 +++ ros-genpy-0.6.0/src/genpy/generate_initpy.py 2016-04-22 02:08:02.000000000 +0000 @@ -48,7 +48,7 @@ return 0 types_in_dir = set([f[1:-3] for f in os.listdir(outdir) if f.endswith('.py') and f != '__init__.py']) - generated_modules = [_module_name(f) for f in types_in_dir] + generated_modules = [_module_name(f) for f in sorted(types_in_dir)] write_module(outdir, generated_modules) return 0 diff -Nru ros-genpy-0.5.7/src/genpy/generator.py ros-genpy-0.6.0/src/genpy/generator.py --- ros-genpy-0.5.7/src/genpy/generator.py 2015-11-09 23:36:57.000000000 +0000 +++ ros-genpy-0.6.0/src/genpy/generator.py 2016-04-22 02:08:02.000000000 +0000 @@ -313,7 +313,7 @@ :returns: concatenated text for msg/srv file and embedded msg/srv types. Text will be escaped for triple-quote, ``str`` """ msg_definition = genmsg.compute_full_text(msg_context, spec) - msg_definition.replace('"""', r'\"\"\"') + msg_definition = msg_definition.replace('"""', r'\"\"\"') return msg_definition ################################################################################ @@ -679,8 +679,8 @@ for y in serializer_generator(msg_context, flattened, True, is_numpy): yield " "+y pop_context() - yield "except struct.error as se: self._check_types(struct.error(\"%s: '%s' when writing '%s'\" % (type(se), str(se), str(_x))))" - yield "except TypeError as te: self._check_types(ValueError(\"%s: '%s' when writing '%s'\" % (type(te), str(te), str(_x))))" + yield "except struct.error as se: self._check_types(struct.error(\"%s: '%s' when writing '%s'\" % (type(se), str(se), str(locals().get('_x', self)))))" + yield "except TypeError as te: self._check_types(ValueError(\"%s: '%s' when writing '%s'\" % (type(te), str(te), str(locals().get('_x', self)))))" # done w/ method-var context # def deserialize_fn_generator(msg_context, spec, is_numpy=False): @@ -769,8 +769,12 @@ yield ' _md5sum = "%s"'%(md5sum) yield ' _type = "%s"'%(fulltype) yield ' _has_header = %s #flag to mark the presence of a Header object'%spec.has_header() - # note: we introduce an extra newline to protect the escaping from quotes in the message - yield ' _full_text = """%s\n"""'%compute_full_text_escaped(msg_context, spec) + + full_text = compute_full_text_escaped(msg_context, spec) + # escape trailing double-quote, unless already escaped, before wrapping in """ + if full_text.endswith('"') and not full_text.endswith(r'\"'): + full_text = full_text[:-1] + r'\"' + yield ' _full_text = """%s"""'%full_text if spec.constants: yield ' # Pseudo-constants' diff -Nru ros-genpy-0.5.7/src/genpy/message.py ros-genpy-0.6.0/src/genpy/message.py --- ros-genpy-0.5.7/src/genpy/message.py 2015-11-09 23:36:57.000000000 +0000 +++ ros-genpy-0.6.0/src/genpy/message.py 2016-04-22 02:08:02.000000000 +0000 @@ -121,7 +121,7 @@ nsec_str = '\n%snsecs: ' % indent + (format_str % val.nsecs) return sec_str + nsec_str else: - return '\n%ssecs: %s\n%snsecs: %s'%(indent, val.secs, indent, val.nsecs) + return '\n%ssecs: %s\n%snsecs: %9d'%(indent, val.secs, indent, val.nsecs) elif type_ in (list, tuple): if len(val) == 0: diff -Nru ros-genpy-0.5.7/src/genpy/rostime.py ros-genpy-0.6.0/src/genpy/rostime.py --- ros-genpy-0.5.7/src/genpy/rostime.py 2015-11-09 23:36:57.000000000 +0000 +++ ros-genpy-0.6.0/src/genpy/rostime.py 2016-04-22 02:08:02.000000000 +0000 @@ -390,41 +390,41 @@ def __floordiv__(self, val): """ Floor divide this duration by an integer or float - :param val: division factor, ``int/float`` - :returns: :class:`Duration` divided by val + :param val: division factor ``int/float``, or :class:`Duration` to divide by + :returns: :class:`Duration` divided by val - a :class:`Duration` if divided by a number, or a number if divided by a duration """ t = type(val) - if t in (int, long): - return Duration(self.secs // val, self.nsecs // val) - elif t == float: + if t in (float, int, long): return Duration.from_sec(self.to_sec() // val) + elif isinstance(val, Duration): + return self.to_sec() // val.to_sec() else: return NotImplemented def __div__(self, val): """ Divide this duration by an integer or float - :param val: division factor, ``int/float`` - :returns: :class:`Duration` divided by val + :param val: division factor ``int/float``, or :class:`Duration` to divide by + :returns: :class:`Duration` divided by val - a :class:`Duration` if divided by a number, or a number if divided by a duration """ - # unlike __floordiv__, this uses true div for float arg. - # PEP 238 t = type(val) - if t in (int, long): - return Duration(self.secs // val, self.nsecs // val) - elif t == float: + if t in (float, int, long): return Duration.from_sec(self.to_sec() / val) + elif isinstance(val, Duration): + return self.to_sec() / val.to_sec() else: return NotImplemented def __truediv__(self, val): """ Divide this duration by an integer or float - :param val: division factor, ``int/float`` - :returns: :class:`Duration` multiplied by val + :param val: division factor ``int/float``, or :class:`Duration` to divide by + :returns: :class:`Duration` divided by val - a :class:`Duration` if divided by a number, or a number if divided by a duration """ if type(val) in (int, long, float): return Duration.from_sec(self.to_sec() / val) + elif isinstance(val, Duration): + return self.to_sec() / val.to_sec() else: return NotImplemented diff -Nru ros-genpy-0.5.7/test/files/array/object_varlen_ser_full.txt ros-genpy-0.6.0/test/files/array/object_varlen_ser_full.txt --- ros-genpy-0.5.7/test/files/array/object_varlen_ser_full.txt 2015-11-09 23:36:57.000000000 +0000 +++ ros-genpy-0.6.0/test/files/array/object_varlen_ser_full.txt 2016-04-22 02:08:02.000000000 +0000 @@ -3,5 +3,5 @@ buff.write(_struct_I.pack(length)) for val1 in self.array: buff.write(_struct_i.pack(val1.data)) -except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x)))) -except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x)))) +except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) +except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))) diff -Nru ros-genpy-0.5.7/test/files/complex/object_ser_full.txt ros-genpy-0.6.0/test/files/complex/object_ser_full.txt --- ros-genpy-0.5.7/test/files/complex/object_ser_full.txt 2015-11-09 23:36:57.000000000 +0000 +++ ros-genpy-0.6.0/test/files/complex/object_ser_full.txt 2016-04-22 02:08:02.000000000 +0000 @@ -1,4 +1,4 @@ try: buff.write(_struct_i.pack(self.data)) -except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x)))) -except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x)))) +except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) +except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))) diff -Nru ros-genpy-0.5.7/test/test_genpy_dynamic.py ros-genpy-0.6.0/test/test_genpy_dynamic.py --- ros-genpy-0.5.7/test/test_genpy_dynamic.py 2015-11-09 23:36:57.000000000 +0000 +++ ros-genpy-0.6.0/test/test_genpy_dynamic.py 2016-04-22 02:08:02.000000000 +0000 @@ -146,4 +146,21 @@ m_instance1.serialize(buff) m_instance2.deserialize(buff.getvalue()) assert m_instance1 == m_instance2 - + + +def test_serialize_exception(): + import genpy + from genpy.dynamic import generate_dynamic + msgs = generate_dynamic("gd_msgs/EasyInt32", "int32 data\n") + assert ['gd_msgs/EasyInt32'] == list(msgs.keys()) + m_cls = msgs['gd_msgs/EasyInt32'] + m_instance = m_cls() + m_instance.data = '1' # the type is incorrect + buff = StringIO() + try: + m_instance.serialize(buff) + assert False, 'This should have raised a genpy.SerializationError' + except genpy.SerializationError: + pass + except Exception: + assert False, 'This should have raised a genpy.SerializationError instead' diff -Nru ros-genpy-0.5.7/test/test_genpy_message.py ros-genpy-0.6.0/test/test_genpy_message.py --- ros-genpy-0.5.7/test/test_genpy_message.py 2015-11-09 23:36:57.000000000 +0000 +++ ros-genpy-0.6.0/test/test_genpy_message.py 2016-04-22 02:08:02.000000000 +0000 @@ -562,10 +562,10 @@ self.d = d self.assertEquals("""t: secs: 987 - nsecs: 654 + nsecs: 654 d: secs: 123 - nsecs: 456""", strify_message(M5(Time(987, 654), Duration(123, 456)))) + nsecs: 456""", strify_message(M5(Time(987, 654), Duration(123, 456)))) # test final clause of strify -- str anything that isn't recognized if sys.hexversion > 0x03000000: # Python3 diff -Nru ros-genpy-0.5.7/test/test_genpy_rostime.py ros-genpy-0.6.0/test/test_genpy_rostime.py --- ros-genpy-0.5.7/test/test_genpy_rostime.py 2015-11-09 23:36:57.000000000 +0000 +++ ros-genpy-0.6.0/test/test_genpy_rostime.py 2016-04-22 02:08:02.000000000 +0000 @@ -31,6 +31,7 @@ # POSSIBILITY OF SUCH DAMAGE. import unittest +import warnings class RostimeTest(unittest.TestCase): @@ -414,16 +415,21 @@ # Test div self.assertEquals(Duration(4), Duration(8) / 2) self.assertEquals(Duration(4), Duration(8) / 2.) - self.assertEquals(Duration(4), Duration(8) // 2) - self.assertEquals(Duration(4), Duration(8) // 2.) - self.assertEquals(Duration(4), Duration(9) // 2) - self.assertEquals(Duration(4), Duration(9) // 2.) + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always') + self.assertEquals(Duration(4), Duration(8) // 2) + self.assertEquals(Duration(4), Duration(8) // 2.) + self.assertEquals(Duration(4), Duration(9) // 2) + self.assertEquals(Duration(4), Duration(9) // 2.) + self.assertEqual(len(w), 0) self.assertEquals(Duration(4, 2), Duration(8, 4) / 2) v = Duration(4, 2) - (Duration(8, 4) / 2.) self.assert_(abs(v.to_nsec()) < 100) - self.assertEquals(Duration(4, 2), Duration(8, 4) // 2) - self.assertEquals(Duration(4, 2), Duration(9, 5) // 2) - v = Duration(4, 2) - (Duration(9, 5) // 2.) - self.assert_(abs(v.to_nsec()) < 100) - + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always') + self.assertEquals(Duration(4, 0), Duration(8, 4) // 2) + self.assertEquals(Duration(4, 0), Duration(9, 5) // 2) + v = Duration(4, 2) - (Duration(9, 5) // 2.) + self.assert_(abs(v.to_nsec()) < 100) + self.assertEqual(len(w), 0) diff -Nru ros-genpy-0.5.7/test/test_genpy_rostime_truediv.py ros-genpy-0.6.0/test/test_genpy_rostime_truediv.py --- ros-genpy-0.5.7/test/test_genpy_rostime_truediv.py 2015-11-09 23:36:57.000000000 +0000 +++ ros-genpy-0.6.0/test/test_genpy_rostime_truediv.py 2016-04-22 02:08:02.000000000 +0000 @@ -55,8 +55,8 @@ v = Duration(4, 2) - (Duration(8, 4) / 2.) self.assert_(abs(v.to_nsec()) < 100) - self.assertEquals(Duration(4, 2), Duration(8, 4) // 2) - self.assertEquals(Duration(4, 2), Duration(9, 5) // 2) + self.assertEquals(Duration(4, 0), Duration(8, 4) // 2) + self.assertEquals(Duration(4, 0), Duration(9, 5) // 2) v = Duration(4, 2) - (Duration(9, 5) // 2.) self.assert_(abs(v.to_nsec()) < 100)