From 3c648ae8e8edbd9791f01f4d1edbc35f7b009b82 Mon Sep 17 00:00:00 2001 From: Mikael Arguedas Date: Sat, 19 Oct 2019 11:42:28 +0200 Subject: [PATCH 1/2] use yaml.safe_load Signed-off-by: Mikael Arguedas --- scripts/add_devel_repo.py | 2 +- scripts/add_release_repo.py | 2 +- scripts/check_duplicates.py | 6 +++--- scripts/check_rosdistro.py | 2 +- scripts/clean_rosdep_yaml.py | 2 +- scripts/sort_yaml.py | 2 +- scripts/yaml2rosinstall.py | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/add_devel_repo.py b/scripts/add_devel_repo.py index 8e59201a3c55b..9bcc2c3d80888 100755 --- a/scripts/add_devel_repo.py +++ b/scripts/add_devel_repo.py @@ -9,7 +9,7 @@ def add_devel_repository(yaml_file, name, vcs_type, url, version=None): - data = yaml.load(open(yaml_file, 'r')) + data = yaml.safe_load(open(yaml_file, 'r')) if data['type'] == 'gbp': add_devel_repository_fuerte(yaml_file, data, name, vcs_type, url, version) return diff --git a/scripts/add_release_repo.py b/scripts/add_release_repo.py index b8aea9d1c7a2e..acd222a8f5bcd 100755 --- a/scripts/add_release_repo.py +++ b/scripts/add_release_repo.py @@ -9,7 +9,7 @@ def add_release_repository(yaml_file, name, url, version): - data = yaml.load(open(yaml_file, 'r')) + data = yaml.safe_load(open(yaml_file, 'r')) if data['type'] == 'gbp': add_release_repository_fuerte(yaml_file, data, name, url, version) return diff --git a/scripts/check_duplicates.py b/scripts/check_duplicates.py index 5642c70d04cd3..3905a67edd82c 100755 --- a/scripts/check_duplicates.py +++ b/scripts/check_duplicates.py @@ -45,7 +45,7 @@ def create_default_sources(): filepath = os.path.join(basedir, 'index.yaml') with open(filepath) as f: content = f.read() - index = yaml.load(content) + index = yaml.safe_load(content) for distro in index['distributions']: distfile = 'file://' + basedir + '/' + distro + '/distribution.yaml' print('loading %s' % distfile) @@ -68,7 +68,7 @@ def create_default_sources(): filepath = os.path.join(basedir, 'rosdep', filename) with open(filepath) as f: content = f.read() - rosdep_data = yaml.load(content) + rosdep_data = yaml.safe_load(content) tag = 'osx' if 'osx-' in filepath else '' sources.append(CachedDataSource('yaml', 'file://' + filepath, [tag], rosdep_data)) return sources @@ -125,7 +125,7 @@ def main(infile): filepath = os.path.join(os.getcwd(), filename) with open(filepath) as f: content = f.read() - rosdep_data = yaml.load(content) + rosdep_data = yaml.safe_load(content) # osx-homebrew uses osx tag tag = 'osx' if 'osx-' in filepath else '' model = CachedDataSource('yaml', 'file://' + filepath, [tag], rosdep_data) diff --git a/scripts/check_rosdistro.py b/scripts/check_rosdistro.py index 374e814d1133a..27f89ebeff111 100755 --- a/scripts/check_rosdistro.py +++ b/scripts/check_rosdistro.py @@ -143,7 +143,7 @@ def my_assert(val): my_assert.clean = True try: - ydict = yaml.load(buf) + ydict = yaml.safe_load(buf) except Exception as e: print_err("could not build the dict: %s" % (str(e))) my_assert(False) diff --git a/scripts/clean_rosdep_yaml.py b/scripts/clean_rosdep_yaml.py index 1fccfebe274ed..6063c2f34ecfc 100755 --- a/scripts/clean_rosdep_yaml.py +++ b/scripts/clean_rosdep_yaml.py @@ -58,7 +58,7 @@ def prn(n, nm, lvl): args = parser.parse_args() with open(args.infile) as f: - iny = yaml.load(f.read()) + iny = yaml.safe_load(f.read()) buf = '' for a in sorted(iny): diff --git a/scripts/sort_yaml.py b/scripts/sort_yaml.py index 514da92eb71bc..0be95ecf7af88 100755 --- a/scripts/sort_yaml.py +++ b/scripts/sort_yaml.py @@ -8,7 +8,7 @@ def sort_yaml(yaml_file): - data = yaml.load(open(yaml_file, 'r')) + data = yaml.safe_load(open(yaml_file, 'r')) if 'version' in data: print('This script does not support the new rosdistro yaml files', file=sys.stderr) sys.exit(1) diff --git a/scripts/yaml2rosinstall.py b/scripts/yaml2rosinstall.py index b2340704eca86..26f2e00084db8 100755 --- a/scripts/yaml2rosinstall.py +++ b/scripts/yaml2rosinstall.py @@ -8,7 +8,7 @@ def convert_yaml_to_rosinstall(yaml_file, rosinstall_file): - data = yaml.load(open(yaml_file, 'r')) + data = yaml.safe_load(open(yaml_file, 'r')) data = convert_yaml_data_to_rosinstall_data(data) with open(rosinstall_file, 'w') as out_file: yaml.dump(data, out_file, default_flow_style=False) From a34566a93e1f5ed840922617923e7144c10b660d Mon Sep 17 00:00:00 2001 From: Mikael Arguedas Date: Sat, 19 Oct 2019 11:51:18 +0200 Subject: [PATCH 2/2] update eol distro list Signed-off-by: Mikael Arguedas --- scripts/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/__init__.py b/scripts/__init__.py index e9ed363d93c43..230b372af38a0 100644 --- a/scripts/__init__.py +++ b/scripts/__init__.py @@ -1 +1 @@ -eol_distro_names = ['groovy', 'hydro', 'jade'] +eol_distro_names = ['ardent', 'bouncy', 'groovy', 'hydro', 'indigo', 'jade', 'lunar']