mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-05 05:04:46 +00:00
Fix configuration.get_modules_info()
Was running hasattr() on a string.
This commit is contained in:
parent
6ada5d9517
commit
491fa98f71
1 changed files with 5 additions and 4 deletions
|
|
@ -17,7 +17,7 @@
|
|||
Store metadata and options.
|
||||
"""
|
||||
|
||||
import importlib.resources
|
||||
import importlib
|
||||
import os
|
||||
import re
|
||||
import urllib.parse
|
||||
|
|
@ -82,10 +82,11 @@ def get_modules_info():
|
|||
"""Return unicode string with detected module info."""
|
||||
module_infos = []
|
||||
for (mod, name, version_attr) in Modules:
|
||||
if not fileutil.has_module(mod):
|
||||
try:
|
||||
module = importlib.import_module(mod)
|
||||
except ModuleNotFoundError:
|
||||
continue
|
||||
if version_attr and hasattr(mod, version_attr):
|
||||
attr = getattr(mod, version_attr)
|
||||
if version_attr and (attr := getattr(module, version_attr, None)):
|
||||
version = attr() if callable(attr) else attr
|
||||
module_infos.append(f"{name} {version}")
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue