IntelFsp2Pkg: Add PACKAGES_PATH support
authorThomaiyar, Richard Marian <richard.marian.thomaiyar@intel.com>
Fri, 25 Nov 2016 09:21:06 +0000 (17:21 +0800)
committerJiewen Yao <jiewen.yao@intel.com>
Wed, 30 Nov 2016 06:37:45 +0000 (14:37 +0800)
Add PACKAGES_PATH support in GenCfgOpt.py

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Richard Thomaiyar <richard.marian.thomaiyar@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
IntelFsp2Pkg/Tools/GenCfgOpt.py

index 654cdfc..0675b55 100644 (file)
@@ -523,9 +523,13 @@ EndList
                                     if Match:\r
                                         IncludeFilePath = Match.group(1)\r
                                         IncludeFilePath = self.ExpandMacros(IncludeFilePath)\r
-                                        try:\r
-                                            IncludeDsc  = open(IncludeFilePath, "r")\r
-                                        except:\r
+                                        PackagesPath = os.getenv("PACKAGES_PATH")\r
+                                        for PackagePath in PackagesPath.split(os.pathsep):\r
+                                            IncludeFilePathAbs = os.path.join(os.path.normpath(PackagePath), os.path.normpath(IncludeFilePath))\r
+                                            if os.path.exists(IncludeFilePathAbs):\r
+                                                IncludeDsc  = open(IncludeFilePathAbs, "r")\r
+                                                break\r
+                                        if IncludeDsc == None:\r
                                             print("ERROR: Cannot open file '%s'" % IncludeFilePath)\r
                                             raise SystemExit\r
                                         NewDscLines = IncludeDsc.readlines()\r