Move hardcoded required Python version into homeassistant.const

This commit is contained in:
Alexander Fortin 2016-02-28 05:41:03 +01:00
parent 8e9c557a2c
commit ac69db8133
2 changed files with 10 additions and 3 deletions

View File

@ -12,15 +12,21 @@ from multiprocessing import Process
import homeassistant.config as config_util
from homeassistant import bootstrap
from homeassistant.const import (
EVENT_HOMEASSISTANT_START, RESTART_EXIT_CODE, __version__)
__version__,
EVENT_HOMEASSISTANT_START,
REQUIRED_PYTHON_VER,
RESTART_EXIT_CODE,
)
def validate_python():
""" Validate we're running the right Python version. """
major, minor = sys.version_info[:2]
req_major, req_minor = REQUIRED_PYTHON_VER
if major < 3 or (major == 3 and minor < 4):
print("Home Assistant requires atleast Python 3.4")
if major < req_major or (major == req_major and minor < req_minor):
print("Home Assistant requires at least Python {}.{}".format(
req_major, req_minor))
sys.exit(1)

View File

@ -2,6 +2,7 @@
"""Constants used by Home Assistant components."""
__version__ = "0.15.0.dev0"
REQUIRED_PYTHON_VER = (3, 4)
# Can be used to specify a catch all when registering state or event listeners.
MATCH_ALL = '*'