From f1f2766b64754c7da574a6a4d5fac609cbf512b1 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 | 51 ++++++++++++++++++++++++++++ edkrepo_dev_requirements_windows.txt | 5 +++ 2 files changed, 56 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..a1c29e8 --- /dev/null +++ b/edkrepo_dev.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +# +## @file +# edkrepo_dev.py +# +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +# + +import sys +import traceback +from importlib.metadata import version, PackageNotFoundError +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 + edkrepo_version = version("edkrepo") + 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 PackageNotFoundError as e: + print("edkrepo running from development source.") + except Exception as e: + traceback.print_exc() + sys.exit(1) + + 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 +