@@ -173,6 +173,7 @@ def _get_packages() -> dict[str, str]:
173
173
packages = sorted (packages , key = lambda x : x .lower ())
174
174
packages = [RENAMES .get (package , package ) for package in packages ]
175
175
out = dict ()
176
+ reasons = []
176
177
for package in status_iterator (
177
178
packages , f"Adding { len (packages )} related software packages: "
178
179
):
@@ -183,12 +184,17 @@ def _get_packages() -> dict[str, str]:
183
184
else :
184
185
md = importlib .metadata .metadata (package )
185
186
except importlib .metadata .PackageNotFoundError :
186
- pass # raise a complete error later
187
+ reasons .append (f"{ package } : not found, needs to be installed" )
188
+ continue # raise a complete error later
187
189
else :
188
190
# Every project should really have this
191
+ do_continue = False
189
192
for key in ("Summary" ,):
190
193
if key not in md :
191
- raise ExtensionError (f"Missing { repr (key )} for { package } " )
194
+ reasons .extend (f"{ package } : missing { repr (key )} " )
195
+ do_continue = True
196
+ if do_continue :
197
+ continue
192
198
# It is annoying to find the home page
193
199
url = None
194
200
if "Home-page" in md :
@@ -204,15 +210,17 @@ def _get_packages() -> dict[str, str]:
204
210
if url is not None :
205
211
break
206
212
else :
207
- raise RuntimeError (
208
- f"Could not find Home-page for { package } in:\n "
209
- f"{ sorted (set (md ))} \n with Summary:\n { md ['Summary' ]} "
213
+ reasons .append (
214
+ f"{ package } : could not find Home-page in { sorted (md )} "
210
215
)
216
+ continue
211
217
out [package ]["url" ] = url
212
218
out [package ]["description" ] = md ["Summary" ].replace ("\n " , "" )
213
- bad = [package for package in packages if not out [package ]]
214
- if bad and REQUIRE_METADATA :
215
- raise ExtensionError (f"Could not find metadata for:\n { ' ' .join (bad )} " )
219
+ reason_str = "\n " .join (reasons )
220
+ if reason_str and REQUIRE_METADATA :
221
+ raise ExtensionError (
222
+ f"Could not find suitable metadata for related software:\n { reason_str } "
223
+ )
216
224
217
225
return out
218
226
0 commit comments