diff --git a/edk2toolext/invocables/edk2_pr_eval.py b/edk2toolext/invocables/edk2_pr_eval.py index 00ac282e..ad5fcb37 100644 --- a/edk2toolext/invocables/edk2_pr_eval.py +++ b/edk2toolext/invocables/edk2_pr_eval.py @@ -141,7 +141,7 @@ def get_packages_to_build(self, possible_packages: list) -> dict: pkg = self.edk2_path_obj.GetContainingPackage(os.path.abspath(f)) except Exception as e: - self.logger.error(f"Failed to get package for file {f}. Exception {e}") + self.logger.warning(f"Failed to get package for file {f}. Exception {e}") # Ignore a file in which we fail to get the package continue @@ -167,7 +167,7 @@ def get_packages_to_build(self, possible_packages: list) -> dict: pkg = self.edk2_path_obj.GetContainingPackage(os.path.abspath(f)) except Exception as e: - self.logger.error(f"Failed to get package for file {f}. Exception {e}") + self.logger.warning(f"Failed to get package for file {f}. Exception {e}") # Ignore a file in which we fail to get the package continue @@ -231,10 +231,16 @@ def _get_unique_module_infs_changed(self, files: list): for f in files: if os.path.splitext(f) in [".txt", ".md"]: # ignore markdown and txt files continue + try: + infs = self.edk2_path_obj.GetContainingModules(os.path.abspath(f)) + except Exception as e: + self.logger.warning(f"Failed to get module for file {f}. Exception: {str(e)}") + # ignore errors. These will occur if a module or last file in folder is deleted as part of the PR + continue - infs = self.edk2_path_obj.GetContainingModules(os.path.abspath(f)) if len(infs) > 0: # if this file is part of any INFs modules.extend(infs) + modules = [self.edk2_path_obj.GetEdk2RelativePathFromAbsolutePath(x) for x in set(modules)] logging.debug("Changed Modules: " + str(modules)) return modules @@ -323,7 +329,7 @@ def _is_public_file(self, filepath): try: pkg = self.edk2_path_obj.GetContainingPackage(os.path.abspath(filepath)) except Exception as e: - self.logger.error(f"Failed to GetContainingPackage({filepath}). Exception: {str(e)}") + self.logger.warning(f"Failed to get package for {filepath}. Exception: {str(e)}") return False dec = None