mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Validate operating system is supported (#64352)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com> Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
5a1e5e1cef
commit
c285743621
@ -12,6 +12,13 @@ from .const import REQUIRED_PYTHON_VER, RESTART_EXIT_CODE, __version__
|
||||
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:
|
||||
@ -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()
|
||||
|
||||
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user