From: Alexis Ballier Date: Wed, 11 Dec 2019 14:25:57 +0000 (+0100) Subject: dev-python/rosdistro: Bump to 0.8.0. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=84befe28db215dff5c1c3a24a08501b485e9c4af;p=gentoo.git dev-python/rosdistro: Bump to 0.8.0. Add py37. Use yaml.safe_load(). Package-Manager: Portage-2.3.81, Repoman-2.3.20 Signed-off-by: Alexis Ballier --- diff --git a/dev-python/rosdistro/Manifest b/dev-python/rosdistro/Manifest index 7887d2f09566..665eed94f0e2 100644 --- a/dev-python/rosdistro/Manifest +++ b/dev-python/rosdistro/Manifest @@ -1,2 +1,3 @@ DIST rosdistro-0.7.2.tar.gz 60091 BLAKE2B 40f2a47fcf5a13d0b8b9eb29fcee9bfbd811a7541dac74e6be76e2c67ba34adf0b7c2df8804300e35262bbb36efa890128e06217c93ecfc834015010e344e42d SHA512 ca6c0d19c2218efe8bf27c1cc22c4c9b683dccb5f8029208e0b581cb358fbe32733895896b1afece45b6576f254f4535032cea962587aa47d93235767c6baf60 DIST rosdistro-0.7.4.tar.gz 60365 BLAKE2B a2b9af6b584abc057d0b5e7d1087438834801eea33555fb094bc938e1ec642a5d41057f61ee3d3f80ca3ea083e8cb6989f6907cfbc9973067a32d0ee505101d8 SHA512 9e2cbc88290b3a132fa5aeec446ca25a89365367a57a97f49cc26533139f91b2a50a1f2f6176f4333900bf7fa21d49c9836d65e74dc8322fe8c5811c49794291 +DIST rosdistro-0.8.0.tar.gz 60527 BLAKE2B 9404452dc62c9f7d1482de3c13df0093ac26a60554c97fa097cb14548cdb814fbdc96a26db2d24aa1f2eb99de86f27807ecdc50e0e00a8fa727af8803ab5d644 SHA512 1f4620454f78bd03f75a8b1b8535588a8d6e50aeef17dbf346e8d0443a6fbc5ec83646767bf86521fb65508e205fc3edb8f0c97a81aec8d6b72088d9d78a14f0 diff --git a/dev-python/rosdistro/files/yaml.patch b/dev-python/rosdistro/files/yaml.patch new file mode 100644 index 000000000000..2f81a0218b89 --- /dev/null +++ b/dev-python/rosdistro/files/yaml.patch @@ -0,0 +1,252 @@ +Index: rosdistro-0.8.0/scripts/rosdistro_convert +=================================================================== +--- rosdistro-0.8.0.orig/scripts/rosdistro_convert ++++ rosdistro-0.8.0/scripts/rosdistro_convert +@@ -58,7 +58,7 @@ def get_targets(): + url = BASE_SRC_URL + '/releases/targets.yaml' + print('Load "%s"' % url) + yaml_str = load_url(url) +- data = yaml.load(yaml_str) ++ data = yaml.safe_load(yaml_str) + targets = {} + for d in data: + targets[d.keys()[0]] = d.values()[0] +@@ -69,13 +69,13 @@ def convert_release(dist_name, targets): + url = BASE_SRC_URL + '/releases/%s.yaml' % dist_name + print('Load "%s"' % url) + yaml_str = load_url(url) +- input_ = yaml.load(yaml_str) ++ input_ = yaml.safe_load(yaml_str) + + # improve conversion performance by reusing results from last run + last_dist = None + if os.path.exists(dist_name + '/release.yaml'): + with open(dist_name + '/release.yaml', 'r') as f: +- last_data = yaml.load(f.read()) ++ last_data = yaml.safe_load(f.read()) + last_dist = ReleaseFile(dist_name, last_data) + + output = {} +@@ -162,7 +162,7 @@ def convert_source(dist_name): + url = BASE_SRC_URL + '/releases/%s-devel.yaml' % dist_name + print('Load "%s"' % url) + yaml_str = load_url(url) +- input_ = yaml.load(yaml_str) ++ input_ = yaml.safe_load(yaml_str) + + output = {} + output['type'] = 'source' +@@ -207,7 +207,7 @@ def convert_doc(dist_name): + if filename.endswith('.rosinstall'): + name = os.path.splitext(os.path.basename(filename))[0] + with open(os.path.join(doc_base, filename)) as f: +- data = yaml.load(f) ++ data = yaml.safe_load(f) + if name.endswith('_depends'): + rosinstall_depends[name] = data + else: +Index: rosdistro-0.8.0/scripts/rosdistro_migrate_to_rep_141 +=================================================================== +--- rosdistro-0.8.0.orig/scripts/rosdistro_migrate_to_rep_141 ++++ rosdistro-0.8.0/scripts/rosdistro_migrate_to_rep_141 +@@ -18,7 +18,7 @@ import yaml + + + def migrate(index_yaml): +- data = yaml.load(open(index_yaml, 'r')) ++ data = yaml.safe_load(open(index_yaml, 'r')) + assert data['type'] == 'index' + assert data['version'] == 1 + data['version'] = 2 +@@ -75,7 +75,7 @@ def generate_repos_url(repos_url, doc_ur + data['repositories'] = {} + + # migrate release stuff +- release_data = yaml.load(open(release_url, 'r')) ++ release_data = yaml.safe_load(open(release_url, 'r')) + assert release_data['type'] == 'release' + assert release_data['version'] == 1 + +@@ -100,7 +100,7 @@ def generate_repos_url(repos_url, doc_ur + data['repositories'][repo_name] = repo_data + + # migrate doc stuff +- doc_data = yaml.load(open(doc_url, 'r')) ++ doc_data = yaml.safe_load(open(doc_url, 'r')) + assert doc_data['type'] == 'doc' + assert doc_data['version'] == 1 + +@@ -111,7 +111,7 @@ def generate_repos_url(repos_url, doc_ur + data['repositories'][repo_name]['doc'] = get_dict_parts(doc_repo_data, ['type', 'url', 'version']) + + # migrate source stuff +- source_data = yaml.load(open(source_url, 'r')) ++ source_data = yaml.safe_load(open(source_url, 'r')) + assert source_data['type'] == 'source' + assert source_data['version'] == 1 + +@@ -137,10 +137,10 @@ def update_cache(index_yaml, distro_name + if not isinstance(yaml_str, str): + yaml_str = yaml_str.decode('utf-8') + f.close() +- cache_data = yaml.load(yaml_str) ++ cache_data = yaml.safe_load(yaml_str) + + del cache_data['release_file'] +- distribution_data = yaml.load(open(os.path.join(base, distribution_file), 'r')) ++ distribution_data = yaml.safe_load(open(os.path.join(base, distribution_file), 'r')) + cache_data['distribution_file'] = distribution_data + + cache_data['release_package_xmls'] = cache_data['package_xmls'] +Index: rosdistro-0.8.0/scripts/rosdistro_migrate_to_rep_143 +=================================================================== +--- rosdistro-0.8.0.orig/scripts/rosdistro_migrate_to_rep_143 ++++ rosdistro-0.8.0/scripts/rosdistro_migrate_to_rep_143 +@@ -10,7 +10,7 @@ import yaml + + + def migrate(index_yaml): +- data = yaml.load(open(index_yaml, 'r')) ++ data = yaml.safe_load(open(index_yaml, 'r')) + assert data['type'] == 'index' + assert data['version'] == 2 + data['version'] = 3 +Index: rosdistro-0.8.0/src/rosdistro/develdistro.py +=================================================================== +--- rosdistro-0.8.0.orig/src/rosdistro/develdistro.py ++++ rosdistro-0.8.0/src/rosdistro/develdistro.py +@@ -8,7 +8,7 @@ import yaml + class DevelDistro: + def __init__(self, name): + url = urlopen('https://raw.github.com/ros/rosdistro/master/releases/{0}-devel.yaml'.format(name)) +- distro = yaml.load(url.read())['repositories'] ++ distro = yaml.safe_load(url.read())['repositories'] + self.repositories = {} + for name, data in distro.iteritems(): + repo = DevelDistroRepo(name, data) +Index: rosdistro-0.8.0/src/rosdistro/legacy.py +=================================================================== +--- rosdistro-0.8.0.orig/src/rosdistro/legacy.py ++++ rosdistro-0.8.0/src/rosdistro/legacy.py +@@ -122,7 +122,7 @@ def get_release_cache(index, dist_name): + f.close() + else: + raise NotImplementedError('The url of the cache must end with either ".yaml" or ".yaml.gz"') +- data = yaml.load(yaml_str) ++ data = yaml.safe_load(yaml_str) + return ReleaseCache(dist_name, data) + + +Index: rosdistro-0.8.0/src/rosdistro/rosdistro.py +=================================================================== +--- rosdistro-0.8.0.orig/src/rosdistro/rosdistro.py ++++ rosdistro-0.8.0/src/rosdistro/rosdistro.py +@@ -161,7 +161,7 @@ class RosDistroFile: + + # parse ros distro file + distro_url = urlopen('https://raw.github.com/ros/rosdistro/master/releases/%s.yaml' % name) +- distro = yaml.load(distro_url.read())['repositories'] ++ distro = yaml.safe_load(distro_url.read())['repositories'] + + # loop over all repo's + for repo_name, data in distro.iteritems(): +@@ -338,7 +338,7 @@ class RosDependencies: + + tar = tarfile.open(fh.name, 'r') + data = tar.extractfile(self.file_name) +- deps = yaml.load(data.read()) ++ deps = yaml.safe_load(data.read()) + if not deps \ + or 'cache_version' not in deps \ + or deps['cache_version'] != CACHE_VERSION \ +Index: rosdistro-0.8.0/test/test_distribution.py +=================================================================== +--- rosdistro-0.8.0.orig/test/test_distribution.py ++++ rosdistro-0.8.0/test/test_distribution.py +@@ -12,7 +12,7 @@ FILES_DIR = os.path.normpath(os.path.joi + def test_distribution_file(): + url = 'file://' + FILES_DIR + '/foo/distribution.yaml' + yaml_str = load_url(url) +- data = yaml.load(yaml_str) ++ data = yaml.safe_load(yaml_str) + dist_file = DistributionFile('foo', data) + _validate_dist_file(dist_file) + +Index: rosdistro-0.8.0/test/test_doc.py +=================================================================== +--- rosdistro-0.8.0.orig/test/test_doc.py ++++ rosdistro-0.8.0/test/test_doc.py +@@ -12,7 +12,7 @@ FILES_DIR = os.path.normpath(os.path.joi + def test_doc_file(): + url = 'file://' + FILES_DIR + '/foo/distribution.yaml' + yaml_str = load_url(url) +- data = yaml.load(yaml_str) ++ data = yaml.safe_load(yaml_str) + doc_file = DocFile('foo', data) + _validate_doc_file(doc_file) + +Index: rosdistro-0.8.0/test/test_doc_build.py +=================================================================== +--- rosdistro-0.8.0.orig/test/test_doc_build.py ++++ rosdistro-0.8.0/test/test_doc_build.py +@@ -12,7 +12,7 @@ FILES_DIR = os.path.normpath(os.path.joi + def test_doc_build_file(): + url = 'file://' + FILES_DIR + '/foo/doc-build.yaml' + yaml_str = load_url(url) +- data = yaml.load(yaml_str) ++ data = yaml.safe_load(yaml_str) + DocBuildFile('foo', data) + + +Index: rosdistro-0.8.0/test/test_release.py +=================================================================== +--- rosdistro-0.8.0.orig/test/test_release.py ++++ rosdistro-0.8.0/test/test_release.py +@@ -12,7 +12,7 @@ FILES_DIR = os.path.normpath(os.path.joi + def test_release_file(): + url = 'file://' + FILES_DIR + '/foo/distribution.yaml' + yaml_str = load_url(url) +- data = yaml.load(yaml_str) ++ data = yaml.safe_load(yaml_str) + rel_file = ReleaseFile('foo', data) + _validate_rel_file(rel_file) + +Index: rosdistro-0.8.0/test/test_release_build.py +=================================================================== +--- rosdistro-0.8.0.orig/test/test_release_build.py ++++ rosdistro-0.8.0/test/test_release_build.py +@@ -12,7 +12,7 @@ FILES_DIR = os.path.normpath(os.path.joi + def test_release_build_file(): + url = 'file://' + FILES_DIR + '/foo/release-build.yaml' + yaml_str = load_url(url) +- data = yaml.load(yaml_str) ++ data = yaml.safe_load(yaml_str) + ReleaseBuildFile('foo', data) + + +Index: rosdistro-0.8.0/test/test_source.py +=================================================================== +--- rosdistro-0.8.0.orig/test/test_source.py ++++ rosdistro-0.8.0/test/test_source.py +@@ -12,7 +12,7 @@ FILES_DIR = os.path.normpath(os.path.joi + def test_source_file(): + url = 'file://' + FILES_DIR + '/foo/distribution.yaml' + yaml_str = load_url(url) +- data = yaml.load(yaml_str) ++ data = yaml.safe_load(yaml_str) + src_file = SourceFile('foo', data) + _validate_src_file(src_file) + +Index: rosdistro-0.8.0/test/test_source_build.py +=================================================================== +--- rosdistro-0.8.0.orig/test/test_source_build.py ++++ rosdistro-0.8.0/test/test_source_build.py +@@ -12,7 +12,7 @@ FILES_DIR = os.path.normpath(os.path.joi + def test_source_build_file(): + url = 'file://' + FILES_DIR + '/foo/source-build.yaml' + yaml_str = load_url(url) +- data = yaml.load(yaml_str) ++ data = yaml.safe_load(yaml_str) + SourceBuildFile('foo', data) + + diff --git a/dev-python/rosdistro/rosdistro-0.8.0.ebuild b/dev-python/rosdistro/rosdistro-0.8.0.ebuild new file mode 100644 index 000000000000..5b587a80181e --- /dev/null +++ b/dev-python/rosdistro/rosdistro-0.8.0.ebuild @@ -0,0 +1,48 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +PYTHON_COMPAT=( python{2_7,3_5,3_6,3_7} pypy{,3} ) + +SCM="" +if [ "${PV#9999}" != "${PV}" ] ; then + SCM="git-r3" + EGIT_REPO_URI="https://github.com/ros-infrastructure/rosdistro" +fi + +inherit ${SCM} distutils-r1 + +DESCRIPTION="Tools to work with catkinized rosdistro files" +HOMEPAGE="http://wiki.ros.org/rosdistro" +if [ "${PV#9999}" != "${PV}" ] ; then + SRC_URI="" + KEYWORDS="" +else + SRC_URI="https://github.com/ros-infrastructure/rosdistro/archive/${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64 ~arm" +fi + +LICENSE="BSD" +SLOT="0" +IUSE="test" +RESTRICT="!test? ( test )" + +RDEPEND=" + dev-python/catkin_pkg[${PYTHON_USEDEP}] + dev-python/rospkg[${PYTHON_USEDEP}] + dev-python/pyyaml[${PYTHON_USEDEP}] + dev-python/setuptools[${PYTHON_USEDEP}]" +BDEPEND=" + dev-python/setuptools[${PYTHON_USEDEP}] + test? ( dev-python/nose[${PYTHON_USEDEP}] ) +" +DEPEND="${RDEPEND} + test? ( + dev-python/mock[${PYTHON_USEDEP}] + ) +" +PATCHES=( "${FILESDIR}/yaml.patch" ) + +python_test() { + nosetests --with-xunit test || die +} diff --git a/dev-python/rosdistro/rosdistro-9999.ebuild b/dev-python/rosdistro/rosdistro-9999.ebuild index ef8fe8bcb38d..1cf2e00b257c 100644 --- a/dev-python/rosdistro/rosdistro-9999.ebuild +++ b/dev-python/rosdistro/rosdistro-9999.ebuild @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -PYTHON_COMPAT=( python{2_7,3_5,3_6} pypy{,3} ) +PYTHON_COMPAT=( python{2_7,3_5,3_6,3_7} pypy{,3} ) SCM="" if [ "${PV#9999}" != "${PV}" ] ; then