# @file EccCheck.py\r
#\r
+# Copyright (c) 2021, Arm Limited. All rights reserved.<BR>\r
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>\r
# SPDX-License-Identifier: BSD-2-Clause-Patent\r
##\r
# - output_stream the StringIO output stream from this plugin via logging\r
def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, PLM, PLMHelper, tc, output_stream=None):\r
edk2_path = Edk2pathObj.WorkspacePath\r
- python_path = os.path.join(edk2_path, "BaseTools", "Source", "Python")\r
+ basetools_path = environment.GetValue("EDK_TOOLS_PATH")\r
+ python_path = os.path.join(basetools_path, "Source", "Python")\r
env = shell_environment.GetEnvironment()\r
env.set_shell_var('PYTHONPATH', python_path)\r
env.set_shell_var('WORKSPACE', edk2_path)\r
self.ECC_PASS = True\r
- self.ApplyConfig(pkgconfig, edk2_path, packagename)\r
+ self.ApplyConfig(pkgconfig, edk2_path, basetools_path, packagename)\r
modify_dir_list = self.GetModifyDir(packagename)\r
patch = self.GetDiff(packagename)\r
ecc_diff_range = self.GetDiffRange(patch, packagename, edk2_path)\r
- self.GenerateEccReport(modify_dir_list, ecc_diff_range, edk2_path)\r
+ self.GenerateEccReport(modify_dir_list, ecc_diff_range, edk2_path, basetools_path)\r
ecc_log = os.path.join(edk2_path, "Ecc.log")\r
self.RevertCode()\r
if self.ECC_PASS:\r
return comment_range\r
\r
def GenerateEccReport(self, modify_dir_list: List[str], ecc_diff_range: Dict[str, List[Tuple[int, int]]],\r
- edk2_path: str) -> None:\r
+ edk2_path: str, basetools_path: str) -> None:\r
ecc_need = False\r
ecc_run = True\r
- config = os.path.join(edk2_path, "BaseTools", "Source", "Python", "Ecc", "config.ini")\r
- exception = os.path.join(edk2_path, "BaseTools", "Source", "Python", "Ecc", "exception.xml")\r
+ config = os.path.join(basetools_path, "Source", "Python", "Ecc", "config.ini")\r
+ exception = os.path.join(basetools_path, "Source", "Python", "Ecc", "exception.xml")\r
report = os.path.join(edk2_path, "Ecc.csv")\r
for modify_dir in modify_dir_list:\r
target = os.path.join(edk2_path, modify_dir)\r
log.writelines(all_line)\r
return\r
\r
- def ApplyConfig(self, pkgconfig: Dict[str, List[str]], edk2_path: str, pkg: str) -> None:\r
+ def ApplyConfig(self, pkgconfig: Dict[str, List[str]], edk2_path: str, basetools_path: str, pkg: str) -> None:\r
if "IgnoreFiles" in pkgconfig:\r
for a in pkgconfig["IgnoreFiles"]:\r
a = os.path.join(edk2_path, pkg, a)\r
\r
if "ExceptionList" in pkgconfig:\r
exception_list = pkgconfig["ExceptionList"]\r
- exception_xml = os.path.join(edk2_path, "BaseTools", "Source", "Python", "Ecc", "exception.xml")\r
+ exception_xml = os.path.join(basetools_path, "Source", "Python", "Ecc", "exception.xml")\r
try:\r
logging.info("Appending exceptions")\r
self.AppendException(exception_list, exception_xml)\r