1# Copyright (c) 2024 Nordic Semiconductor ASA
2#
3# SPDX-License-Identifier: Apache-2.0
4from __future__ import annotations
5
6import os
7import sys
8import logging
9
10from pathlib import Path
11
12ZEPHYR_BASE = os.environ['ZEPHYR_BASE']
13sys.path.insert(0, os.path.join(ZEPHYR_BASE, 'scripts', 'pylib', 'build_helpers'))
14
15from domains import Domains
16
17logger = logging.getLogger(__name__)
18logging.getLogger('pykwalify').setLevel(logging.ERROR)
19
20
21def get_default_domain_name(domains_file: Path | str) -> int:
22    """
23    Get the default domain name from the domains.yaml file
24    """
25    domains = Domains.from_file(domains_file)
26    logger.debug("Loaded sysbuild domain data from %s" % domains_file)
27    return domains.get_default_domain().name
28