From 41d739e4ecb189e1c5e478a55a8a21b0784f2c76 Mon Sep 17 00:00:00 2001 From: "Thomaiyar, Richard Marian" Date: Fri, 25 Nov 2016 17:21:06 +0800 Subject: [PATCH] IntelFsp2Pkg: Add PACKAGES_PATH support Add PACKAGES_PATH support in GenCfgOpt.py Cc: Maurice Ma Cc: Jiewen Yao Cc: Giri P Mudusuru Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Richard Thomaiyar Reviewed-by: Jiewen Yao Reviewed-by: Giri P Mudusuru --- IntelFsp2Pkg/Tools/GenCfgOpt.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt.py index 654cdfc835..0675b55c16 100644 --- a/IntelFsp2Pkg/Tools/GenCfgOpt.py +++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py @@ -523,9 +523,13 @@ EndList if Match: IncludeFilePath = Match.group(1) IncludeFilePath = self.ExpandMacros(IncludeFilePath) - try: - IncludeDsc = open(IncludeFilePath, "r") - except: + PackagesPath = os.getenv("PACKAGES_PATH") + for PackagePath in PackagesPath.split(os.pathsep): + IncludeFilePathAbs = os.path.join(os.path.normpath(PackagePath), os.path.normpath(IncludeFilePath)) + if os.path.exists(IncludeFilePathAbs): + IncludeDsc = open(IncludeFilePathAbs, "r") + break + if IncludeDsc == None: print("ERROR: Cannot open file '%s'" % IncludeFilePath) raise SystemExit NewDscLines = IncludeDsc.readlines()