From d776e4ad4752823f26c38cf769e3a6dfb515491d Mon Sep 17 00:00:00 2001 From: Junjie Mao Date: Thu, 10 Mar 2022 19:23:04 +0800 Subject: [PATCH] config_tools: packaging config tool scripts for easier import The next-generation ACRN configurator will embed a Python interpreter built in WebAssembly (WASM) for executing Python scripts for manipulating scenario schemas and validating user data. It is quite tedious to separately import multiple modules there due to the restriction of that Python environment. The recommended approach is to package those modules (e.g. as a *.wic file) so that all modules can be imported in one shot. This patch adds the files needed to package the scripts. The package is solely used for the configurator to import and not intended to be used by end users for any purpose. v1 -> v2: * Fix the license header of __init__.py * Move patterns of ignored files to the top-level .gitignore Tracked-On: #6691 Signed-off-by: Junjie Mao Reviewed-by: Geoffroy Van Cutsem --- .gitignore | 2 ++ misc/config_tools/LICENSE | 1 + misc/config_tools/README | 7 ------ misc/config_tools/README.md | 10 ++++++++ misc/config_tools/pyproject.toml | 6 +++++ misc/config_tools/scenario_config/__init__.py | 8 ++++++ misc/config_tools/setup.cfg | 25 +++++++++++++++++++ 7 files changed, 52 insertions(+), 7 deletions(-) create mode 120000 misc/config_tools/LICENSE delete mode 100644 misc/config_tools/README create mode 100644 misc/config_tools/README.md create mode 100644 misc/config_tools/pyproject.toml create mode 100644 misc/config_tools/scenario_config/__init__.py create mode 100644 misc/config_tools/setup.cfg diff --git a/.gitignore b/.gitignore index e98fe896f..8028c98fb 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ build *.warnings *.pyc /offline-tools/ +*.egg-info +/misc/config_tools/dist diff --git a/misc/config_tools/LICENSE b/misc/config_tools/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/misc/config_tools/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/misc/config_tools/README b/misc/config_tools/README deleted file mode 100644 index eac74ecf7..000000000 --- a/misc/config_tools/README +++ /dev/null @@ -1,7 +0,0 @@ -folder structure - - board_inspector : Get target board information under native Linux environment and generate board_info XML. - board_config : Parse board_info XML and scenario XML to generate board related configuration files under misc/acrn-config/xmls/board-xmls/ folder. - scenario_config : Parse board_info XML and scenario XML to generate scenario based VM configuration files under misc/acrn-config/xmls/config-xmls/$(BOARD)/ folder. - launch_config : Parse board_info XML, scenario XML and devicemodel param XML to generate launch script for post-launched vm under misc/acrn-config/xmls/config-xmls/$(BOARD)/ folder. - library : The folder stores shared software modules or libs for acrn-config offline tool. diff --git a/misc/config_tools/README.md b/misc/config_tools/README.md new file mode 100644 index 000000000..66c8eb4d7 --- /dev/null +++ b/misc/config_tools/README.md @@ -0,0 +1,10 @@ +# Supporting libraries of ACRN configuration toolset + +This package contains the libraries supporting ACRN configuration toolset, including: + +* The manipulators and validators of scenario schemas or XMLs +* The generator of guest ACPI tables + +The main objective of this package is to ease the import of the supporting libraries in the ACRN configurator which uses +a Python interpreter built in WebAssembly (WASM). This package is thus NOT intended to be used by users; invoke the +Python scripts directly if needed. diff --git a/misc/config_tools/pyproject.toml b/misc/config_tools/pyproject.toml new file mode 100644 index 000000000..404db610e --- /dev/null +++ b/misc/config_tools/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = [ + "setuptools>=42", + "wheel", +] +build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/misc/config_tools/scenario_config/__init__.py b/misc/config_tools/scenario_config/__init__.py new file mode 100644 index 000000000..23ac0b791 --- /dev/null +++ b/misc/config_tools/scenario_config/__init__.py @@ -0,0 +1,8 @@ +# Copyright (C) 2022 Intel Corporation. +# +# SPDX-License-Identifier: BSD-3-Clause +# + +# The __init__.py for packaging. +import sys, os +sys.path.append(os.path.dirname(os.path.realpath(__file__))) diff --git a/misc/config_tools/setup.cfg b/misc/config_tools/setup.cfg new file mode 100644 index 000000000..7408d88ea --- /dev/null +++ b/misc/config_tools/setup.cfg @@ -0,0 +1,25 @@ +[metadata] +name = acrn-config-tools +version = 3.0 +author = Intel +author_email = acrn-dev@lists.projectacrn.org +description = Supporting libraries of ACRN configuration toolset +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/projectacrn/acrn-hypervisor +project_urls = + Bug Tracker = https://github.com/projectacrn/acrn-hypervisor/issues +classifiers = + Programming Language :: Python :: 3 + License :: OSI Approved :: BSD-3-Clause License + Operating System :: OS Independent + Private :: Do Not Upload + +[options] +package_dir = + = . +packages = find: +python_requires = >=3.6 + +[options.packages.find] +where = .