From 1c4a6ed8214940f82461f90190a8a689676669a5 Mon Sep 17 00:00:00 2001 From: Nathaniel Haller Date: Tue, 30 Apr 2024 15:03:58 -0700 Subject: [PATCH] Add a script to run edkrepo_cli.py without edkrepo installed to host. As the edkrepo installer is not run, include a requirements file for the python requirements. Signed-off-by: Nathaniel Haller --- edkrepo_dev.py | 54 ++++++++++++++++++++++++++++ edkrepo_dev_requirements_windows.txt | 5 +++ 2 files changed, 59 insertions(+) create mode 100644 edkrepo_dev.py create mode 100644 edkrepo_dev_requirements_windows.txt diff --git a/edkrepo_dev.py b/edkrepo_dev.py new file mode 100644 index 0000000..0277709 --- /dev/null +++ b/edkrepo_dev.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 +# +## @file +# edkrepo_dev.py +# +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +# + +import sys +import traceback +if sys.version_info >= (3, 8): + from importlib.metadata import version +else: + import pkg_resources +from edkrepo.config.config_factory import GlobalConfig +from edkrepo.common.edkrepo_exception import EdkrepoGlobalConfigNotFoundException +from edkrepo import edkrepo_cli + +if __name__ == '__main__': + # Run the edkrepo command line interface without building and running the edkrepo installer. + # Minimum Python version and Git version in README.md + # Additional Python requirements in edkrepo_dev_requirements_windows.txt + # EdkRepo 'git bash' features support require the installer to use. + try: + # If a global config file was not installed, do not continue further. + GlobalConfig() + except EdkrepoGlobalConfigNotFoundException as e: + traceback.print_exc() + print() + print("Create a global edkrepo.cfg file before running edkrepo_dev.py.") + print("example global config file: edk2-edkrepo/edkrepo_installer/Vendor/edkrepo.cfg") + sys.exit(102) + except Exception as e: + traceback.print_exc() + sys.exit(1) + + try: + # If system has edkrepo installed, exit + if sys.version_info >= (3, 8): + edkrepo_version = version("edkrepo") + else: + edkrepo_version = pkg_resources.get_distribution("edkrepo").version + print("Edkrepo is found installed on the system. Edkrepo version: ", edkrepo_version) + print("Run the edkrepo uninstaller before using 'edkrepo_dev.py'.") + sys.exit(1) + except: + print("edkrepo running from development source.") + + try: + sys.exit(edkrepo_cli.main()) + except Exception as e: + traceback.print_exc() + sys.exit(1) diff --git a/edkrepo_dev_requirements_windows.txt b/edkrepo_dev_requirements_windows.txt new file mode 100644 index 0000000..25c18e4 --- /dev/null +++ b/edkrepo_dev_requirements_windows.txt @@ -0,0 +1,5 @@ +colorama>=0.4.4 +gitdb>=4.0.7 +GitPython>=3.1.14 +smmap>=4.0.0 +