Skip to content

Commit

Permalink
Add a script to run edkrepo_cli.py without edkrepo installed to host.
Browse files Browse the repository at this point in the history
As the edkrepo installer is not run, include a requirements file for the python requirements.

Signed-off-by: Nathaniel Haller <[email protected]>
  • Loading branch information
ndhaller committed May 2, 2024
1 parent a1b3f8e commit 1c4a6ed
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
54 changes: 54 additions & 0 deletions edkrepo_dev.py
Original file line number Diff line number Diff line change
@@ -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)
5 changes: 5 additions & 0 deletions edkrepo_dev_requirements_windows.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
colorama>=0.4.4
gitdb>=4.0.7
GitPython>=3.1.14
smmap>=4.0.0

0 comments on commit 1c4a6ed

Please sign in to comment.