output more descriptive output when dependencies fail

This commit is contained in:
Jakob Ketterl 2022-06-01 17:11:45 +02:00
parent 843dde1a68
commit be8e35cbcf
2 changed files with 11 additions and 3 deletions

View File

@ -89,12 +89,17 @@ Support and info: https://groups.io/g/openwebrx
coreConfig = CoreConfig()
featureDetector = FeatureDetector()
if not featureDetector.is_available("core"):
failed = featureDetector.get_failed_requirements("core")
if failed:
logger.error(
"you are missing required dependencies to run openwebrx. "
"please check that the following core requirements are installed and up to date:"
"please check that the following core requirements are installed and up to date: %s",
", ".join(failed)
)
logger.error(", ".join(featureDetector.get_requirements("core")))
for f in failed:
description = featureDetector.get_requirement_description(f)
if description:
logger.error("description for %s:\n%s", f, description)
return
# Get error messages about unknown / unavailable features as soon as possible

View File

@ -110,6 +110,9 @@ class FeatureDetector(object):
def is_available(self, feature):
return self.has_requirements(self.get_requirements(feature))
def get_failed_requirements(self, feature):
return [req for req in self.get_requirements(feature) if not self.has_requirement(req)]
def get_requirements(self, feature):
try:
return FeatureDetector.features[feature]