Skip to content

Commit

Permalink
Merge branch 'master' into allow_build_wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
Javagedes committed Nov 9, 2022
2 parents ea2febc + 24f080b commit 393f8e4
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 47 deletions.
8 changes: 4 additions & 4 deletions BasicDevTests.py
Expand Up @@ -18,7 +18,7 @@
import re


def TestEncodingOk(apath, encodingValue): # noqa
def TestEncodingOk(apath, encodingValue):
try:
with open(apath, "rb") as f_obj:
f_obj.read().decode(encodingValue)
Expand All @@ -29,7 +29,7 @@ def TestEncodingOk(apath, encodingValue): # noqa
return True


def TestFilenameLowercase(apath): # noqa
def TestFilenameLowercase(apath):
if apath != apath.lower():
logging.critical(f"Lowercase failure: file {apath} not lower case path")
logging.error(f"\n\tLOWERCASE: {apath.lower()}\n\tINPUTPATH: {apath}")
Expand All @@ -47,14 +47,14 @@ def PackageAndModuleValidCharacters(apath):
return True


def TestNoSpaces(apath): # noqa
def TestNoSpaces(apath):
if " " in apath:
logging.critical(f"NoSpaces failure: file {apath} has spaces in path")
return False
return True


def TestRequiredLicense(apath): # noqa
def TestRequiredLicense(apath):
licenses = ["SPDX-License-Identifier: BSD-2-Clause-Patent", ]
try:
with open(apath, "rb") as f_obj:
Expand Down
2 changes: 2 additions & 0 deletions azure-pipelines/templates/build-test-job.yml
Expand Up @@ -34,6 +34,8 @@ jobs:
- template: flake8-test-steps.yml

- template: pydocstyle-test-steps.yml
parameters:
root_package_folder: ${{parameters.root_package_folder}}

- template: spell-test-steps.yml

Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines/templates/pydocstyle-test-steps.yml
Expand Up @@ -7,15 +7,15 @@
##

parameters:
none: ''
root_package_folder: ''

steps:
- script: pydocstyle .
- script: pydocstyle ${{parameters.root_package_folder}}
displayName: 'Run pydocstyle'
condition: succeededOrFailed()

# Only capture and archive the lint log on failures.
- script: pydocstyle . > pydocstyle.err.log
- script: pydocstyle ${{parameters.root_package_folder}} > pydocstyle.err.log
displayName: 'Capture pydocstyle failures'
condition: Failed()

Expand Down
2 changes: 1 addition & 1 deletion docs/developing.md
Expand Up @@ -97,7 +97,7 @@ out all the different parts.
2. Run a Basic Python docstring Check (using pydocstring) and resolve any issues

``` cmd
pydocstyle .
pydocstyle edk2toolext
```

3. Run the `BasicDevTests.py` script to check file encoding, file naming, etc
Expand Down
4 changes: 3 additions & 1 deletion edk2toolext/__init__.py
Expand Up @@ -3,5 +3,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
"""This file exists to satisfy pythons packaging requirements.
# noqa
Read more: https://docs.python.org/3/reference/import.html#regular-packages
"""
4 changes: 3 additions & 1 deletion edk2toolext/bin/__init__.py
Expand Up @@ -3,5 +3,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
"""This file exists to satisfy pythons packaging requirements.
# noqa
Read more: https://docs.python.org/3/reference/import.html#regular-packages
"""
4 changes: 3 additions & 1 deletion edk2toolext/environment/__init__.py
Expand Up @@ -3,5 +3,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
"""This file exists to satisfy pythons packaging requirements.
# noqa
Read more: https://docs.python.org/3/reference/import.html#regular-packages
"""
3 changes: 1 addition & 2 deletions edk2toolext/environment/extdeptypes/__init__.py
Expand Up @@ -3,5 +3,4 @@
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

# noqa
"""This package contains the different ext_dep types available in the environment."""
35 changes: 21 additions & 14 deletions edk2toolext/environment/plugin_manager.py
Expand Up @@ -9,7 +9,7 @@

import sys
import os
import imp
import importlib
import logging
from edk2toolext.environment import shell_environment

Expand Down Expand Up @@ -82,32 +82,39 @@ def _load(self, PluginDescriptor):
PluginDescriptor(PluginDescriptor): the plugin descriptor
"""
PluginDescriptor.Obj = None
PythonFileName = PluginDescriptor.descriptor["module"] + ".py"
PyModulePath = os.path.join(os.path.dirname(os.path.abspath(
PluginDescriptor.descriptor["descriptor_file"])), PythonFileName)
logging.debug("Loading Plugin from %s", PyModulePath)

py_file_path = PluginDescriptor.descriptor["module"] + ".py"
py_module_path = os.path.join(os.path.dirname(os.path.abspath(
PluginDescriptor.descriptor["descriptor_file"])), py_file_path)
py_module_name = "UefiBuild_Plugin_" + PluginDescriptor.descriptor["module"]

logging.debug("Loading Plugin from %s", py_module_path)

try:
with open(PyModulePath, "r") as plugin_file:
_module = imp.load_module(
"UefiBuild_Plugin_" + PluginDescriptor.descriptor["module"],
plugin_file,
PyModulePath,
("py", "r", imp.PY_SOURCE))
spec = importlib.util.spec_from_file_location(
py_module_name, py_module_path)
module = importlib.util.module_from_spec(spec)
sys.modules[py_module_name] = module

py_module_dir = os.path.dirname(py_module_path)
if py_module_dir not in sys.path:
sys.path.append(py_module_dir)

spec.loader.exec_module(module)
except Exception:
exc_info = sys.exc_info()
logging.error("Failed to import plugin: %s",
PyModulePath, exc_info=exc_info)
py_module_path, exc_info=exc_info)
return -1

# Instantiate the plugin
try:
obj = getattr(_module, PluginDescriptor.descriptor["module"])
obj = getattr(module, PluginDescriptor.descriptor["module"])
PluginDescriptor.Obj = obj()
except AttributeError:
exc_info = sys.exc_info()
logging.error("Failed to instantiate plugin: %s",
PyModulePath, exc_info=exc_info)
py_module_path, exc_info=exc_info)
return -1

return 0
3 changes: 1 addition & 2 deletions edk2toolext/environment/plugintypes/__init__.py
Expand Up @@ -3,5 +3,4 @@
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

# noqa
"""This package contains the different plugin types available in the environment."""
3 changes: 1 addition & 2 deletions edk2toolext/invocables/__init__.py
Expand Up @@ -3,5 +3,4 @@
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

# noqa
"""This package contains the different invocables available to the developer."""
4 changes: 3 additions & 1 deletion edk2toolext/tests/__init__.py
Expand Up @@ -3,5 +3,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
"""This file exists to satisfy pythons packaging requirements.
# noqa
Read more: https://docs.python.org/3/reference/import.html#regular-packages
"""
4 changes: 2 additions & 2 deletions integration_test/Shared_Keywords.robot
Expand Up @@ -159,10 +159,10 @@ Stuart platform build
Should Be Equal As Integers ${result.rc} 0

Stuart platform run
[Arguments] ${setting_file} ${arch} ${target} ${tool_chain} ${addtional_flags} ${ws}
[Arguments] ${setting_file} ${arch} ${target} ${tool_chain} ${additional_flags} ${ws}
Log to console Stuart Build Run
${result}= Run Process stuart_build
... -c ${setting_file} -a ${arch} TOOL_CHAIN_TAG\=${tool_chain} TARGET\=${target} --FlashOnly ${addtional_flags}
... -c ${setting_file} -a ${arch} TOOL_CHAIN_TAG\=${tool_chain} TARGET\=${target} --FlashOnly ${additional_flags}
... cwd=${ws} stdout=stdout.txt stderr=stderr.txt
Log Many stdout: ${result.stdout} stderr: ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Expand Down
16 changes: 8 additions & 8 deletions integration_test/edk2_stuart_pr_eval.robot
Expand Up @@ -168,7 +168,7 @@ Test Stuart PR for Policy 4 module c file changed that platform dsc depends on
Stage changed file ${file_to_modify} ${ws_root}
Commit changes "Changes" ${ws_root}

# Platform CI test DSC dependnency on implementation file # Policy 4
# Platform CI test DSC dependency on implementation file # Policy 4
${pkgs}= Stuart pr evaluation ${platform_ci_file} OvmfPkg ${default_branch} ${EMPTY} ${ws_root}
Confirm same contents ${pkgs} OvmfPkg

Expand All @@ -189,7 +189,7 @@ Test Stuart PR for Policy 4 module c file changed that platform dsc does not dep
Stage changed file ${file_to_modify} ${ws_root}
Commit changes "Changes" ${ws_root}

# Platform CI test DSC dependnency on implementation file # Policy 4
# Platform CI test DSC dependency on implementation file # Policy 4
${pkgs}= Stuart pr evaluation ${platform_ci_file} OvmfPkg ${default_branch} ${EMPTY} ${ws_root}
Should Be Empty ${pkgs}

Expand All @@ -209,7 +209,7 @@ Test Stuart PR for all policies when a PR contains a deleted file
Stage changed file ${file_to_modify} ${ws_root}
Commit changes "Changes" ${ws_root}

# Platform CI test DSC dependnency on implementation file # Policy 4
# Platform CI test DSC dependency on implementation file # Policy 4
${pkgs}= Stuart pr evaluation ${platform_ci_file} OvmfPkg ${default_branch} ${EMPTY} ${ws_root}
Should Be Empty ${pkgs}

Expand All @@ -229,7 +229,7 @@ Test Stuart PR for all policies when a PR contains a deleted folder
Stage changed file ${file_to_modify} ${ws_root}
Commit changes "Changes" ${ws_root}

# Platform CI test DSC dependnency on implementation file # Policy 4
# Platform CI test DSC dependency on implementation file # Policy 4
${pkgs}= Stuart pr evaluation ${platform_ci_file} OvmfPkg ${default_branch} ${EMPTY} ${ws_root}
Should Be Empty ${pkgs}

Expand All @@ -249,7 +249,7 @@ Test Stuart PR for all policies when a PR contains multiple levels of deleted fo
Stage changed file ${file_to_modify} ${ws_root}
Commit changes "Changes" ${ws_root}

# Platform CI test DSC dependnency on implementation file # Policy 4
# Platform CI test DSC dependency on implementation file # Policy 4
${pkgs}= Stuart pr evaluation ${platform_ci_file} OvmfPkg ${default_branch} ${EMPTY} ${ws_root}
Confirm same contents ${pkgs} OvmfPkg

Expand All @@ -270,7 +270,7 @@ Test Stuart PR for all policies when a PR contains file added
Stage changed file ${location_to_move} ${ws_root}
Commit changes "Changes" ${ws_root}

# Platform CI test DSC dependnency on implementation file # Policy 4
# Platform CI test DSC dependency on implementation file # Policy 4
${pkgs}= Stuart pr evaluation ${platform_ci_file} OvmfPkg ${default_branch} ${EMPTY} ${ws_root}
Confirm same contents ${pkgs} OvmfPkg

Expand All @@ -291,7 +291,7 @@ Test Stuart PR for all policies when a PR contains directory added
Stage changed file ${location_to_move} ${ws_root}
Commit changes "Changes" ${ws_root}

# Platform CI test DSC dependnency on implementation file # Policy 4
# Platform CI test DSC dependency on implementation file # Policy 4
${pkgs}= Stuart pr evaluation ${platform_ci_file} OvmfPkg ${default_branch} ${EMPTY} ${ws_root}
Should Be Empty ${pkgs}

Expand All @@ -312,7 +312,7 @@ Test Stuart PR for changing a file at the root of repo
Stage changed file ${file_to_modify} ${ws_root}
Commit changes "Changes" ${ws_root}

# Platform CI test DSC dependnency on implementation file # Policy 4
# Platform CI test DSC dependency on implementation file # Policy 4
${pkgs}= Stuart pr evaluation ${platform_ci_file} OvmfPkg ${default_branch} ${EMPTY} ${ws_root}
Should Be Empty ${pkgs}

Expand Down
10 changes: 5 additions & 5 deletions integration_test/mu_stuart_pr_eval.robot
Expand Up @@ -195,7 +195,7 @@ Test Stuart PR using ProjectMu for all policies when a PR contains a deleted fol
Stage changed file ${file_to_modify} ${ws_root}
Commit changes "Changes" ${ws_root}

# Platform CI test DSC dependnency on implementation file # Policy 4
# Platform CI test DSC dependency on implementation file # Policy 4
${pkgs}= Stuart pr evaluation ${core_ci_file} PcAtChipsetPkg ${default_branch} ${EMPTY} ${ws_root}
Should Be Empty ${pkgs}

Expand All @@ -219,7 +219,7 @@ Test Stuart PR using ProjectMu for all policies when a PR contains a deleted fol
# Stage changed file ${file_to_modify} ${ws_root}
# Commit changes "Changes" ${ws_root}

# # Platform CI test DSC dependnency on implementation file # Policy 4
# # Platform CI test DSC dependency on implementation file # Policy 4
# ${pkgs}= Stuart pr evaluation ${core_ci_file} SecurityPkg ${default_branch} ${EMPTY} ${ws_root}
# Should Be Empty ${pkgs}

Expand All @@ -240,7 +240,7 @@ Test Stuart PR using ProjectMu for all policies when a PR contains file added
Stage changed file ${location_to_move} ${ws_root}
Commit changes "Changes" ${ws_root}

# Platform CI test DSC dependnency on implementation file # Policy 4
# Platform CI test DSC dependency on implementation file # Policy 4
${pkgs}= Stuart pr evaluation ${core_ci_file} MdeModulePkg ${default_branch} ${EMPTY} ${ws_root}
Should Be Empty ${pkgs}

Expand All @@ -261,7 +261,7 @@ Test Stuart PR for all policies when a PR contains directory added
Stage changed file ${location_to_move} ${ws_root}
Commit changes "Changes" ${ws_root}

# Platform CI test DSC dependnency on implementation file # Policy 4
# Platform CI test DSC dependency on implementation file # Policy 4
${pkgs}= Stuart pr evaluation ${core_ci_file} UefiCpuPkg ${default_branch} ${EMPTY} ${ws_root}
Should Be Empty ${pkgs}

Expand All @@ -282,7 +282,7 @@ Test Stuart PR for changing a file at the root of repo
Stage changed file ${file_to_modify} ${ws_root}
Commit changes "Changes" ${ws_root}

# Platform CI test DSC dependnency on implementation file # Policy 4
# Platform CI test DSC dependency on implementation file # Policy 4
${pkgs}= Stuart pr evaluation ${core_ci_file} MdePkg ${default_branch} ${EMPTY} ${ws_root}
Should Be Empty ${pkgs}

Expand Down

0 comments on commit 393f8e4

Please sign in to comment.