Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate operating system is supported #64352

Merged
merged 2 commits into from
Jan 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions homeassistant/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
FAULT_LOG_FILENAME = "home-assistant.log.fault"


def validate_os() -> None:
"""Validate that Home Assistant is running in a supported operating system."""
if not sys.platform.startswith(("darwin", "linux")):
print("Home Assistant only supports Linux, OSX and Windows using WSL")
sys.exit(1)


def validate_python() -> None:
"""Validate that the right Python version is running."""
if sys.version_info[:3] < REQUIRED_PYTHON_VER:
Expand Down Expand Up @@ -108,6 +115,11 @@ def get_arguments() -> argparse.Namespace:
parser.add_argument(
"--script", nargs=argparse.REMAINDER, help="Run one of the embedded scripts"
)
parser.add_argument(
"--ignore-os-check",
action="store_true",
help="Skips validation of operating system",
)

arguments = parser.parse_args()

Expand Down Expand Up @@ -146,6 +158,9 @@ def main() -> int:

args = get_arguments()

if not args.ignore_os_check:
validate_os()

if args.script is not None:
# pylint: disable=import-outside-toplevel
from . import scripts
Expand Down