dev-ros/rosparam: add another upstream yaml.load patch
authorAlexis Ballier <aballier@gentoo.org>
Thu, 12 Dec 2019 12:29:14 +0000 (13:29 +0100)
committerAlexis Ballier <aballier@gentoo.org>
Thu, 12 Dec 2019 12:30:58 +0000 (13:30 +0100)
Package-Manager: Portage-2.3.81, Repoman-2.3.20
Signed-off-by: Alexis Ballier <aballier@gentoo.org>
dev-ros/rosparam/files/yaml2.patch [new file with mode: 0644]
dev-ros/rosparam/rosparam-1.14.3-r1.ebuild

diff --git a/dev-ros/rosparam/files/yaml2.patch b/dev-ros/rosparam/files/yaml2.patch
new file mode 100644 (file)
index 0000000..1e36844
--- /dev/null
@@ -0,0 +1,76 @@
+From 29053c4832229efa7160fb944c05e3bc82e11540 Mon Sep 17 00:00:00 2001
+From: Martijn Buijs <Martijn.buijs@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/rosparam/src/rosparam/__init__.py b/tools/rosparam/src/rosparam/__init__.py
+index 41b806711..3279ab97d 100644
+--- a/tools/rosparam/src/rosparam/__init__.py
++++ b/tools/rosparam/src/rosparam/__init__.py
+@@ -99,6 +99,7 @@ def construct_yaml_binary(loader, node):
+ # register the (de)serializers with pyyaml
+ yaml.add_representer(Binary,represent_xml_binary)
+ yaml.add_constructor(u'tag:yaml.org,2002:binary', construct_yaml_binary)
++yaml.SafeLoader.add_constructor(u'tag:yaml.org,2002:binary', construct_yaml_binary)
+ def construct_angle_radians(loader, node):
+     """
+@@ -185,7 +186,7 @@ def load_str(str, filename, default_namespace=None, verbose=False):
+     """
+     paramlist = []
+     default_namespace = default_namespace or get_ros_namespace()
+-    for doc in yaml.load_all(str):
++    for doc in yaml.safe_load_all(str):
+         if NS in doc:
+             ns = ns_join(default_namespace, doc.get(NS, None))
+             if verbose:
+@@ -633,10 +634,14 @@ def yamlmain(argv=None):
+ yaml.add_constructor(u'!radians', construct_angle_radians)
+ yaml.add_constructor(u'!degrees', construct_angle_degrees)
++yaml.SafeLoader.add_constructor(u'!radians', construct_angle_radians)
++yaml.SafeLoader.add_constructor(u'!degrees', construct_angle_degrees)
+ # allow both !degrees 180, !radians 2*pi
+ pattern = re.compile(r'^deg\([^\)]*\)$')
+ yaml.add_implicit_resolver(u'!degrees', pattern, first="deg(")
++yaml.SafeLoader.add_implicit_resolver(u'!degrees', pattern, first="deg(")
+ pattern = re.compile(r'^rad\([^\)]*\)$')
+ yaml.add_implicit_resolver(u'!radians', pattern, first="rad(")
++yaml.SafeLoader.add_implicit_resolver(u'!radians', pattern, first="rad(")
index 01c504f690f3072f3966cac33b350ce995a6ce95..844e4cb3b011ac9403a4ce4dc345283f1b522db8 100644 (file)
@@ -20,4 +20,4 @@ RDEPEND="
        dev-python/pyyaml[${PYTHON_USEDEP}]
 "
 DEPEND="${RDEPEND}"
-PATCHES=( "${FILESDIR}/yaml.patch" )
+PATCHES=( "${FILESDIR}/yaml.patch" "${FILESDIR}/yaml2.patch" )