From 7136bd69e1191f0792d903a0d62114f6974690f3 Mon Sep 17 00:00:00 2001 From: Alexis Ballier Date: Thu, 12 Dec 2019 13:29:14 +0100 Subject: dev-ros/rosparam: add another upstream yaml.load patch Package-Manager: Portage-2.3.81, Repoman-2.3.20 Signed-off-by: Alexis Ballier --- dev-ros/rosparam/files/yaml2.patch | 76 ++++++++++++++++++++++++++++++ dev-ros/rosparam/rosparam-1.14.3-r1.ebuild | 2 +- 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 dev-ros/rosparam/files/yaml2.patch (limited to 'dev-ros/rosparam') diff --git a/dev-ros/rosparam/files/yaml2.patch b/dev-ros/rosparam/files/yaml2.patch new file mode 100644 index 000000000000..1e36844ee38c --- /dev/null +++ b/dev-ros/rosparam/files/yaml2.patch @@ -0,0 +1,76 @@ +From 29053c4832229efa7160fb944c05e3bc82e11540 Mon Sep 17 00:00:00 2001 +From: Martijn Buijs +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(") + diff --git a/dev-ros/rosparam/rosparam-1.14.3-r1.ebuild b/dev-ros/rosparam/rosparam-1.14.3-r1.ebuild index 01c504f690f3..844e4cb3b011 100644 --- a/dev-ros/rosparam/rosparam-1.14.3-r1.ebuild +++ b/dev-ros/rosparam/rosparam-1.14.3-r1.ebuild @@ -20,4 +20,4 @@ RDEPEND=" dev-python/pyyaml[${PYTHON_USEDEP}] " DEPEND="${RDEPEND}" -PATCHES=( "${FILESDIR}/yaml.patch" ) +PATCHES=( "${FILESDIR}/yaml.patch" "${FILESDIR}/yaml2.patch" ) -- cgit v1.2.3-65-gdbad