commit:     b7071607a41b9f1a1c1c19164075db4d103841b3
Author:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 12 13:49:12 2019 +0000
Commit:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
CommitDate: Thu Dec 12 14:46:57 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b7071607

dev-ros/rostopic: upstream yaml & py3 fixes

Package-Manager: Portage-2.3.81, Repoman-2.3.20
Signed-off-by: Alexis Ballier <aballier <AT> gentoo.org>

 dev-ros/rostopic/files/py3.patch                   | 89 ++++++++++++++++++++++
 dev-ros/rostopic/files/yaml.patch                  | 71 +++++++++++++++++
 ...pic-1.14.3.ebuild => rostopic-1.14.3-r1.ebuild} |  1 +
 3 files changed, 161 insertions(+)

diff --git a/dev-ros/rostopic/files/py3.patch b/dev-ros/rostopic/files/py3.patch
new file mode 100644
index 00000000000..51f5da5aa77
--- /dev/null
+++ b/dev-ros/rostopic/files/py3.patch
@@ -0,0 +1,89 @@
+From 1933acfa8107a164ec825d3223d14589fefd1b5b Mon Sep 17 00:00:00 2001
+From: Dirk Thomas <dirk-tho...@users.noreply.github.com>
+Date: Tue, 6 Aug 2019 16:06:51 -0700
+Subject: [PATCH] more Python 3 compatibility (#1783)
+
+---
+ test/test_rospy/test/unit/test_genmsg_py.py   |  6 +--
+ tools/rosgraph/src/rosgraph/roslogging.py     |  2 +-
+ .../test/test_roslogging_user_logger.py       |  8 +++-
+ tools/roslaunch/test/unit/test_xmlloader.py   |  2 +-
+ tools/rosmsg/src/rosmsg/__init__.py           |  2 +-
+ tools/rosmsg/test/test_rosmsg_command_line.py | 46 +++++++++----------
+ .../test/test_rosmsgproto_command_line.py     | 20 ++++----
+ .../test_rostopic_command_line_offline.py     | 44 +++++++++---------
+ 8 files changed, 67 insertions(+), 63 deletions(-)
+
+diff --git a/tools/rostopic/test/test_rostopic_command_line_offline.py 
b/tools/rostopic/test/test_rostopic_command_line_offline.py
+index 5dab1ad16..37a81faaa 100644
+--- a/tools/rostopic/test/test_rostopic_command_line_offline.py
++++ b/tools/rostopic/test/test_rostopic_command_line_offline.py
+@@ -48,9 +48,9 @@ def test_cmd_help(self):
+         cmd = 'rostopic'
+ 
+         sub = ['bw', 'echo', 'hz', 'delay', 'info', 'list', 'pub', 
'type','find']
+-        output = Popen([cmd], stdout=PIPE).communicate()[0]
++        output = Popen([cmd], stdout=PIPE).communicate()[0].decode()
+         self.assert_('Commands' in output)
+-        output = Popen([cmd, '-h'], stdout=PIPE).communicate()[0]
++        output = Popen([cmd, '-h'], stdout=PIPE).communicate()[0].decode()
+         self.assert_('Commands' in output)
+         # make sure all the commands are in the usage
+         for c in sub:
+@@ -59,16 +59,16 @@ def test_cmd_help(self):
+ 
+         for c in sub:
+             output = Popen([cmd, c, '-h'], stdout=PIPE, 
stderr=PIPE).communicate()
+-            self.assert_("usage:" in output[0].lower(), output)
++            self.assert_("usage:" in output[0].decode().lower(), output)
+             # make sure usage refers to the command
+-            self.assert_("%s %s"%(cmd, c) in output[0], output)
++            self.assert_("%s %s"%(cmd, c) in output[0].decode(), output)
+             
+         # test no args on commands that require args
+         for c in ['bw', 'echo', 'hz', 'delay', 'info', 'pub', 'type', 'find']:
+             output = Popen([cmd, c], stdout=PIPE, stderr=PIPE).communicate()
+-            self.assert_("usage:" in output[0].lower() or "usage:" in 
output[1].lower(), output)
++            self.assert_("usage:" in output[0].decode().lower() or "usage:" 
in output[1].decode().lower(), output)
+             # make sure usage refers to the command
+-            self.assert_("%s %s"%(cmd, c) in output[1], output)
++            self.assert_("%s %s"%(cmd, c) in output[1].decode(), output)
+             
+     def test_offline(self):
+         cmd = 'rostopic'
+@@ -80,19 +80,19 @@ def test_offline(self):
+ 
+         msg = "ERROR: Unable to communicate with master!\n"
+ 
+-        output = Popen([cmd, 'bw', 'chatter'], **kwds).communicate()
+-        self.assert_(output[1].endswith(msg))
+-        output = Popen([cmd, 'echo', 'chatter'], **kwds).communicate()
+-        self.assert_(output[1].endswith(msg))
+-        output = Popen([cmd, 'hz', 'chatter'], **kwds).communicate()
+-        self.assert_(output[1].endswith(msg))
+-        output = Popen([cmd, 'delay', 'chatter'], **kwds).communicate()
+-        self.assert_(output[1].endswith(msg))
+-        output = Popen([cmd, 'list'], **kwds).communicate()
+-        self.assert_(output[1].endswith(msg))
+-        output = Popen([cmd, 'pub', 'chatter', 'std_msgs/String', 'hello'], 
**kwds).communicate()
+-        self.assert_(output[1].endswith(msg))
+-        output = Popen([cmd, 'type', 'chatter'], **kwds).communicate()
+-        self.assert_(output[1].endswith(msg))
+-        output = Popen([cmd, 'type', 'std_msgs/String'], **kwds).communicate()
+-        self.assert_(output[1].endswith(msg))
++        output = Popen([cmd, 'bw', 'chatter'], 
**kwds).communicate()[1].decode()
++        self.assert_(output.endswith(msg))
++        output = Popen([cmd, 'echo', 'chatter'], 
**kwds).communicate()[1].decode()
++        self.assert_(output.endswith(msg))
++        output = Popen([cmd, 'hz', 'chatter'], 
**kwds).communicate()[1].decode()
++        self.assert_(output.endswith(msg))
++        output = Popen([cmd, 'delay', 'chatter'], 
**kwds).communicate()[1].decode()
++        self.assert_(output.endswith(msg))
++        output = Popen([cmd, 'list'], **kwds).communicate()[1].decode()
++        self.assert_(output.endswith(msg))
++        output = Popen([cmd, 'pub', 'chatter', 'std_msgs/String', 'hello'], 
**kwds).communicate()[1].decode()
++        self.assert_(output.endswith(msg))
++        output = Popen([cmd, 'type', 'chatter'], 
**kwds).communicate()[1].decode()
++        self.assert_(output.endswith(msg))
++        output = Popen([cmd, 'type', 'std_msgs/String'], 
**kwds).communicate()[1].decode()
++        self.assert_(output.endswith(msg))

diff --git a/dev-ros/rostopic/files/yaml.patch 
b/dev-ros/rostopic/files/yaml.patch
new file mode 100644
index 00000000000..e96337b5054
--- /dev/null
+++ b/dev-ros/rostopic/files/yaml.patch
@@ -0,0 +1,71 @@
+From 29053c4832229efa7160fb944c05e3bc82e11540 Mon Sep 17 00:00:00 2001
+From: Martijn Buijs <martijn.bu...@gmail.com>
+Date: Tue, 23 Apr 2019 18:20:12 +0200
+Subject: [PATCH] Switch to yaml.safe_load(_all) to prevent YAMLLoadWarning
+ (#1688)
+
+* Switch to yaml.safe_load(_all) to prevent YAMLLoadWarning
+
+* Change all usages of yaml.load to yaml.safe_load
+
+* Extend PyYAML's SafeLoader and use it with `yaml.load`
+
+Also added convenience functions for using this loader for reuse in
+`roslaunch`
+
+* fix typo in rosparam.yaml_load_all
+
+* Modify Loader and SafeLoader in yaml module directly
+
+* Revert whitespace change
+
+* Revert unrelated change to import through global variable construction
+---
+ clients/rospy/src/rospy/client.py             |  2 +-
+ .../test/test_roslib_message.py               |  2 +-
+ .../client_verification/test_slave_api.py     |  2 +-
+ test/test_rosparam/test/check_rosparam.py     |  8 ++---
+ .../check_rosparam_command_line_online.py     |  2 +-
+ .../check_rosservice_command_line_online.py   |  4 +--
+ test/test_rostopic/test/test_rostopic_unit.py | 30 +++++++++----------
+ tools/rosbag/src/rosbag/bag.py                |  2 +-
+ tools/rosgraph/src/rosgraph/roslogging.py     |  2 +-
+ tools/roslaunch/src/roslaunch/loader.py       |  4 +--
+ .../test/unit/test_roslaunch_dump_params.py   |  4 +--
+ tools/rosparam/src/rosparam/__init__.py       |  7 ++++-
+ tools/rosservice/src/rosservice/__init__.py   |  4 +--
+ tools/rostopic/src/rostopic/__init__.py       |  6 ++--
+ tools/topic_tools/scripts/relay_field         |  2 +-
+ 15 files changed, 43 insertions(+), 38 deletions(-)
+
+diff --git a/tools/rostopic/src/rostopic/__init__.py 
b/tools/rostopic/src/rostopic/__init__.py
+index ad244b0f0..41138562e 100644
+--- a/tools/rostopic/src/rostopic/__init__.py
++++ b/tools/rostopic/src/rostopic/__init__.py
+@@ -1779,7 +1779,7 @@ def _rostopic_cmd_pub(argv):
+     try:
+         pub_args = []
+         for arg in args[2:]:
+-            pub_args.append(yaml.load(arg))
++            pub_args.append(yaml.safe_load(arg))
+     except Exception as e:
+         parser.error("Argument error: "+str(e))
+ 
+@@ -1822,7 +1822,7 @@ def bagy_iter():
+         try:
+             with open(filename, 'r') as f:
+                 # load all documents
+-                data = yaml.load_all(f)
++                data = yaml.safe_load_all(f)
+                 for d in data:
+                     yield [d]
+         except yaml.YAMLError as e:
+@@ -2014,7 +2014,7 @@ def stdin_yaml_arg():
+ 
+             if arg.strip() == '---': # End of document
+                 try:
+-                    loaded = yaml.load(buff.rstrip())
++                    loaded = yaml.safe_load(buff.rstrip())
+                 except Exception as e:
+                     sys.stderr.write("Invalid YAML: %s\n"%str(e))
+                 if loaded is not None:

diff --git a/dev-ros/rostopic/rostopic-1.14.3.ebuild 
b/dev-ros/rostopic/rostopic-1.14.3-r1.ebuild
similarity index 90%
rename from dev-ros/rostopic/rostopic-1.14.3.ebuild
rename to dev-ros/rostopic/rostopic-1.14.3-r1.ebuild
index bc869fd3fbe..db7295a22db 100644
--- a/dev-ros/rostopic/rostopic-1.14.3.ebuild
+++ b/dev-ros/rostopic/rostopic-1.14.3-r1.ebuild
@@ -25,3 +25,4 @@ DEPEND="${RDEPEND}
                dev-python/nose[${PYTHON_USEDEP}]
        )
 "
+PATCHES=( "${FILESDIR}/yaml.patch" "${FILESDIR}/py3.patch" )

Reply via email to