xref: /dpdk/dts/framework/utils.py (revision af0785a2447b307965377b62f46a5f39457a85a3)
1# SPDX-License-Identifier: BSD-3-Clause
2# Copyright(c) 2010-2014 Intel Corporation
3# Copyright(c) 2022 PANTHEON.tech s.r.o.
4# Copyright(c) 2022 University of New Hampshire
5
6import sys
7
8
9def check_dts_python_version() -> None:
10    if sys.version_info.major < 3 or (
11        sys.version_info.major == 3 and sys.version_info.minor < 10
12    ):
13        print(
14            RED(
15                (
16                    "WARNING: DTS execution node's python version is lower than"
17                    "python 3.10, is deprecated and will not work in future releases."
18                )
19            ),
20            file=sys.stderr,
21        )
22        print(RED("Please use Python >= 3.10 instead"), file=sys.stderr)
23
24
25def GREEN(text: str) -> str:
26    return f"\u001B[32;1m{str(text)}\u001B[0m"
27
28
29def RED(text: str) -> str:
30    return f"\u001B[31;1m{str(text)}\u001B[0m"
31