From 09f1983d406586cecde586b506d9461a9b63df81 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 30 Apr 2015 22:44:24 -0700 Subject: [PATCH] Update dependency check in __main__ --- homeassistant/__main__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/homeassistant/__main__.py b/homeassistant/__main__.py index a1f9b9e4818..83a8c499718 100644 --- a/homeassistant/__main__.py +++ b/homeassistant/__main__.py @@ -7,6 +7,14 @@ import argparse import importlib +# Home Assistant dependencies, mapped module -> package name +DEPENDENCIES = { + 'requests': 'requests', + 'yaml': 'pyyaml', + 'pytz': 'pytz', +} + + def validate_python(): """ Validate we're running the right Python version. """ major, minor = sys.version_info[:2] @@ -20,13 +28,13 @@ def validate_dependencies(): """ Validate all dependencies that HA uses. """ import_fail = False - for module in ['requests']: + for module, name in DEPENDENCIES.items(): try: importlib.import_module(module) except ImportError: import_fail = True print( - 'Fatal Error: Unable to find dependency {}'.format(module)) + 'Fatal Error: Unable to find dependency {}'.format(name)) if import_fail: print(("Install dependencies by running: "