Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions edk2toollib/uefi/edk2/path_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def GetAbsolutePathOnThisSystemFromEdk2RelativePath(self, *relpath: str, log_err

return None

def GetContainingPackage(self, InputPath: str) -> str:
def GetContainingPackage(self, InputPath: str) -> str | None:
"""Finds the package that contains the given path.

This isn't perfect, but at least identifies the direcotry consistently.
Expand All @@ -277,7 +277,7 @@ def GetContainingPackage(self, InputPath: str) -> str:
(str): name of the package that the path is in.
"""
self.logger.debug("GetContainingPackage: %s" % InputPath)
InputPath = Path(InputPath.replace("\\", "/"))
InputPath : Path = Path(InputPath.replace("\\", "/"))
# Make a list that has the path case normalized for comparison.
# Note: This only does anything on Windows

Expand Down Expand Up @@ -306,7 +306,8 @@ def GetContainingPackage(self, InputPath: str) -> str:
if dirpath.exists():
for f in dirpath.iterdir():
if f.suffix.lower() == ".dec":
return dirpath.name
better = self.GetEdk2RelativePathFromAbsolutePath(dirpath.as_posix())
return better

dirpath = dirpath.parent

Expand Down
Loading