Skip to content

Commit

Permalink
resolve deprecation warnings (#567)
Browse files Browse the repository at this point in the history
Resolves deprecation warnings from edk2-pytool-library to update
parsers to use SetEdk2Path() instead of SetBaseAbsPath() and
SetPackagePaths()
  • Loading branch information
Javagedes authored May 26, 2023
1 parent 439fd58 commit 485ec15
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
9 changes: 3 additions & 6 deletions edk2toolext/environment/uefi_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from edk2toollib.uefi.edk2.parsers.targettxt_parser import TargetTxtParser
from edk2toollib.uefi.edk2.parsers.dsc_parser import DscParser
from edk2toollib.uefi.edk2.parsers.fdf_parser import FdfParser
from edk2toollib.uefi.edk2.path_utilities import Edk2Path
from edk2toollib.utility_functions import RunCmd, RemoveTree
from edk2toolext import edk2_logging
from edk2toolext.environment.plugintypes.uefi_build_plugin import IUefiBuildPlugin
Expand Down Expand Up @@ -680,9 +681,7 @@ def ParseDscFile(self):
input_vars = self.env.GetAllNonBuildKeyValues()
# Update with special environment set build keys
input_vars.update(self.env.GetAllBuildKeyValues())

dscp = DscParser().SetBaseAbsPath(self.ws).SetPackagePaths(
self.pp.split(os.pathsep)).SetInputVars(input_vars)
dscp = DscParser().SetEdk2Path(Edk2Path(self.ws, self.pp.split(os.pathsep))).SetInputVars(input_vars)
dscp.ParseFile(dsc_file_path)
for key, value in dscp.LocalVars.items():
# set env as overrideable
Expand Down Expand Up @@ -711,9 +710,7 @@ def ParseFdfFile(self):
input_vars = self.env.GetAllNonBuildKeyValues()
# Update with special environment set build keys
input_vars.update(self.env.GetAllBuildKeyValues())

fdf_parser = FdfParser().SetBaseAbsPath(self.ws).SetPackagePaths(
self.pp.split(os.pathsep)).SetInputVars(input_vars)
fdf_parser = FdfParser().SetEdk2Path(Edk2Path(self.ws, self.pp.split(os.pathsep))).SetInputVars(input_vars)
pa = self.mws.join(self.ws, self.env.GetValue("FLASH_DEFINITION"))
fdf_parser.ParseFile(pa)
for key, value in fdf_parser.LocalVars.items():
Expand Down
9 changes: 3 additions & 6 deletions edk2toolext/invocables/edk2_pr_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,7 @@ def get_packages_to_build(self, possible_packages: list) -> dict:
changed_modules = [Path(m) for m in changed_modules]

# now check DSC
dsc = DscParser()
dsc.SetBaseAbsPath(self.edk2_path_obj.WorkspacePath)
dsc.SetPackagePaths(self.edk2_path_obj.PackagePathList)
dsc = DscParser().SetEdk2Path(self.edk2_path_obj)
# given that PR eval runs before dependencies are downloaded we must tolerate errors
dsc.SetNoFailMode()
dsc.SetInputVars(PlatformDscInfo[1])
Expand Down Expand Up @@ -345,8 +343,7 @@ def _does_pkg_depend_on_package(self, package_to_eval: str, support_package: str
# For each INF file
for f in inf_files:
ip = InfParser()
ip.SetBaseAbsPath(self.edk2_path_obj.WorkspacePath).SetPackagePaths(
self.edk2_path_obj.PackagePathList).ParseFile(f)
ip.SetEdk2Path(self.edk2_path_obj).ParseFile(f)

for p in ip.PackagesUsed:
if p.startswith(support_package):
Expand Down Expand Up @@ -406,7 +403,7 @@ def _parse_dec_for_package(self, path_to_package):

# parse it
dec = DecParser()
dec.SetBaseAbsPath(self.edk2_path_obj.WorkspacePath).SetPackagePaths(self.edk2_path_obj.PackagePathList)
dec.SetEdk2Path(self.edk2_path_obj)
dec.ParseFile(wsr_dec_path)
return dec

Expand Down
2 changes: 1 addition & 1 deletion tests.unit/test_edk2_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def GetWorkspaceRoot(self) -> str:
def GetRequiredSubmodules(self) -> list[RequiredSubmodule]:
return [
RequiredSubmodule('Common\BAD_REPO', True)
RequiredSubmodule('Common\\BAD_REPO', True)
]
def GetPackagesSupported(self) -> list[str]:
Expand Down

0 comments on commit 485ec15

Please sign in to comment.