summaryrefslogtreecommitdiff
path: root/dev-python/rosdistro/files/yaml.patch
blob: 2f81a0218b899662df72e0b79a84f15aad8efca3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
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)