1#!/usr/bin/env python3 2# 3# Copyright (c) 2018-2022, Intel Corporation 4# 5# SPDX-License-Identifier: BSD-3-Clause 6# 7# Show installed versions of doc building tools 8 9import os.path 10import sys 11import pkg_resources 12import subprocess 13 14class color: 15 PURPLE = '\033[95m' 16 CYAN = '\033[96m' 17 DARKCYAN = '\033[36m' 18 BLUE = '\033[94m' 19 GREEN = '\033[92m' 20 YELLOW = '\033[93m' 21 RED = '\033[91m' 22 BOLD = '\033[1m' 23 UNDERLINE = '\033[4m' 24 END = '\033[0m' 25 26# Check all requirements listed in requirements.txt and print out version installed (if any) 27print ("doc build tool versions found on your system...\n") 28 29rf = open(os.path.join(sys.path[0], "requirements.txt"),"r") 30 31for reqs in pkg_resources.parse_requirements(rf): 32 try: 33 ver = pkg_resources.get_distribution(reqs.project_name).version 34 print (" " + reqs.project_name.ljust(25," ") + " version: " + ver) 35 if not reqs.__contains__(ver): 36 print (color.RED + color.BOLD + " >>> Warning: Expected version " + 37 reqs.__str__() + " Python module from scripts/requirements.text." + color.END) 38 except: 39 print (color.RED + color.BOLD + reqs.project_name + " is missing." + color.END + 40 " (Hint: install all dependencies with " + color.YELLOW + 41 "\"pip3 install --user -r scripts/requirements.txt\"" + color.END + ")") 42 43rf.close() 44 45# Print out the version of Doxygen (not installed via pip3) 46print (" " + "doxygen".ljust(25," ") + " version: " + subprocess.check_output(["doxygen", "-v"]).decode("utf-8")) 47