diff options
author | Alexis Ballier <aballier@gentoo.org> | 2019-12-11 15:07:18 +0100 |
---|---|---|
committer | Alexis Ballier <aballier@gentoo.org> | 2019-12-11 16:26:23 +0100 |
commit | 465dadec0b854f7e7e7cdfa9b13ad8186b5ddfbb (patch) | |
tree | 42767fff1d957d707288396800f8d5932306e5e6 /dev-python/rospkg | |
parent | dev-python/rospkg: bump to 1.2.0. (diff) | |
download | gentoo-465dadec0b854f7e7e7cdfa9b13ad8186b5ddfbb.tar.gz gentoo-465dadec0b854f7e7e7cdfa9b13ad8186b5ddfbb.tar.bz2 gentoo-465dadec0b854f7e7e7cdfa9b13ad8186b5ddfbb.zip |
dev-python/rospkg: use yaml.safe_load
Package-Manager: Portage-2.3.81, Repoman-2.3.20
Signed-off-by: Alexis Ballier <aballier@gentoo.org>
Diffstat (limited to 'dev-python/rospkg')
-rw-r--r-- | dev-python/rospkg/files/yaml_load.patch | 52 | ||||
-rw-r--r-- | dev-python/rospkg/rospkg-1.2.0.ebuild | 2 | ||||
-rw-r--r-- | dev-python/rospkg/rospkg-9999.ebuild | 2 |
3 files changed, 54 insertions, 2 deletions
diff --git a/dev-python/rospkg/files/yaml_load.patch b/dev-python/rospkg/files/yaml_load.patch new file mode 100644 index 000000000000..f56b6db59ad8 --- /dev/null +++ b/dev-python/rospkg/files/yaml_load.patch @@ -0,0 +1,52 @@ +Index: rospkg-1.2.0/src/rospkg/distro.py +=================================================================== +--- rospkg-1.2.0.orig/src/rospkg/distro.py ++++ rospkg-1.2.0/src/rospkg/distro.py +@@ -192,14 +192,14 @@ def load_distro(source_uri): + if os.path.isfile(source_uri): + # load rosdistro file + with open(source_uri) as f: +- raw_data = yaml.load(f.read()) ++ raw_data = yaml.safe_load(f.read()) + else: + try: + request = urlopen(source_uri) + except Exception as e: + raise ResourceNotFound('%s (%s)' % (str(e), source_uri)) + try: +- raw_data = yaml.load(request) ++ raw_data = yaml.safe_load(request) + except ValueError: + raise ResourceNotFound(source_uri) + if not type(raw_data) == dict: +Index: rospkg-1.2.0/test/test_rospkg_distro.py +=================================================================== +--- rospkg-1.2.0.orig/test/test_rospkg_distro.py ++++ rospkg-1.2.0/test/test_rospkg_distro.py +@@ -315,7 +315,7 @@ def test_load_distro_simple(): + + assert distro.release_name == 'simple', distro.release_name + assert distro.version == '1', distro.version +- assert yaml.load(open(p)) == distro.raw_data, distro.raw_data ++ assert yaml.safe_load(open(p)) == distro.raw_data, distro.raw_data + assert set(distro.variants.keys()) == set(['base']) + assert set(distro.stacks.keys()) == set(['stack1']) + +@@ -334,7 +334,7 @@ def test_load_distro_diamondback(): + + assert distro.release_name == 'diamondback', distro.release_name + assert distro.version == 'r8596', distro.version +- assert yaml.load(open(p)) == distro.raw_data, distro.raw_data ++ assert yaml.safe_load(open(p)) == distro.raw_data, distro.raw_data + assert set(distro.variants.keys()) == set(diamondback_variants) + assert set(distro.stacks.keys()) == set(diamondback_stacks), set(distro.stacks.keys()) ^ set(diamondback_stacks) + +@@ -350,7 +350,7 @@ def test_load_distro_diamondback(): + + def test__load_variants(): + from rospkg.distro import _load_variants +- raw_data = yaml.load("""variants: ++ raw_data = yaml.safe_load("""variants: + - ros-base: + stacks: [ros, ros_comm] + - ros-full: diff --git a/dev-python/rospkg/rospkg-1.2.0.ebuild b/dev-python/rospkg/rospkg-1.2.0.ebuild index bb6a7366b4ad..49c3524f1d4a 100644 --- a/dev-python/rospkg/rospkg-1.2.0.ebuild +++ b/dev-python/rospkg/rospkg-1.2.0.ebuild @@ -42,7 +42,7 @@ DEPEND="${RDEPEND} ${BDEPEND} dev-python/mock[${PYTHON_USEDEP}] ) " -PATCHES=( "${FILESDIR}/gentoo.patch" ) +PATCHES=( "${FILESDIR}/gentoo.patch" "${FILESDIR}/yaml_load.patch" ) python_test() { nosetests --with-coverage --cover-package=rospkg --with-xunit test || die diff --git a/dev-python/rospkg/rospkg-9999.ebuild b/dev-python/rospkg/rospkg-9999.ebuild index bb6a7366b4ad..49c3524f1d4a 100644 --- a/dev-python/rospkg/rospkg-9999.ebuild +++ b/dev-python/rospkg/rospkg-9999.ebuild @@ -42,7 +42,7 @@ DEPEND="${RDEPEND} ${BDEPEND} dev-python/mock[${PYTHON_USEDEP}] ) " -PATCHES=( "${FILESDIR}/gentoo.patch" ) +PATCHES=( "${FILESDIR}/gentoo.patch" "${FILESDIR}/yaml_load.patch" ) python_test() { nosetests --with-coverage --cover-package=rospkg --with-xunit test || die |