]> xenbits.xensource.com Git - people/aperard/ovmf.git/commitdiff
BaseTools/WindowsVsToolChain: Clean up Python source formatting
authorSean Brogan <sean.brogan@microsoft.com>
Thu, 6 Feb 2020 23:07:15 +0000 (07:07 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 7 Feb 2020 07:04:16 +0000 (07:04 +0000)
https://bugzilla.tianocore.org/show_bug.cgi?id=2495

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain.py

index a8202e5992a52ab539ffaa17b3159d57aee80436..bcb0648c855c2e497885f10c019f5be50a032d78 100644 (file)
@@ -1,4 +1,4 @@
-## @file WindowsVsToolChain.py\r
+# @file WindowsVsToolChain.py\r
 # Plugin to configures paths for the VS2017 and VS2019 tool chain\r
 ##\r
 # This plugin works in conjuncture with the tools_def\r
@@ -14,6 +14,7 @@ from edk2toollib.windows.locate_tools import FindWithVsWhere
 from edk2toolext.environment import shell_environment\r
 from edk2toolext.environment import version_aggregator\r
 \r
+\r
 class WindowsVsToolChain(IUefiBuildPlugin):\r
 \r
     def do_post_build(self, thebuilder):\r
@@ -25,9 +26,9 @@ class WindowsVsToolChain(IUefiBuildPlugin):
 #\r
         # VS2017 - Follow VS2017 where there is potential for many versions of the tools.\r
         # If a specific version is required then the user must set both env variables:\r
-        ## VS150INSTALLPATH:  base install path on system to VC install dir.  Here you will find the VC folder, etc\r
-        ## VS150TOOLVER:      version number for the VC compiler tools\r
-        ## VS2017_PREFIX:     path to MSVC compiler folder with trailing slash (can be used instead of two vars above)\r
+        # VS150INSTALLPATH:  base install path on system to VC install dir.  Here you will find the VC folder, etc\r
+        # VS150TOOLVER:      version number for the VC compiler tools\r
+        # VS2017_PREFIX:     path to MSVC compiler folder with trailing slash (can be used instead of two vars above)\r
         if thebuilder.env.GetValue("TOOL_CHAIN_TAG") == "VS2017":\r
 \r
             # check to see if full path already configured\r
@@ -35,11 +36,13 @@ class WindowsVsToolChain(IUefiBuildPlugin):
                 self.Logger.info("VS2017_PREFIX is already set.")\r
 \r
             else:\r
-                install_path = self._get_vs_install_path("VS2017".lower(), "VS150INSTALLPATH")\r
+                install_path = self._get_vs_install_path(\r
+                    "VS2017".lower(), "VS150INSTALLPATH")\r
                 vc_ver = self._get_vc_version(install_path, "VS150TOOLVER")\r
 \r
                 if install_path is None or vc_ver is None:\r
-                    self.Logger.error("Failed to configure environment for VS2017")\r
+                    self.Logger.error(\r
+                        "Failed to configure environment for VS2017")\r
                     return -1\r
 \r
                 version_aggregator.GetVersionAggregator().ReportVersion(\r
@@ -47,8 +50,9 @@ class WindowsVsToolChain(IUefiBuildPlugin):
                 version_aggregator.GetVersionAggregator().ReportVersion(\r
                     "VC Version", vc_ver, version_aggregator.VersionTypes.TOOL)\r
 \r
-                #make VS2017_PREFIX to align with tools_def.txt\r
-                prefix = os.path.join(install_path, "VC", "Tools", "MSVC", vc_ver)\r
+                # make VS2017_PREFIX to align with tools_def.txt\r
+                prefix = os.path.join(install_path, "VC",\r
+                                      "Tools", "MSVC", vc_ver)\r
                 prefix = prefix + os.path.sep\r
                 shell_environment.GetEnvironment().set_shell_var("VS2017_PREFIX", prefix)\r
 \r
@@ -60,9 +64,9 @@ class WindowsVsToolChain(IUefiBuildPlugin):
         #\r
         # VS2019 - Follow VS2019 where there is potential for many versions of the tools.\r
         # If a specific version is required then the user must set both env variables:\r
-        ## VS160INSTALLPATH:  base install path on system to VC install dir.  Here you will find the VC folder, etc\r
-        ## VS160TOOLVER:      version number for the VC compiler tools\r
-        ## VS2019_PREFIX:     path to MSVC compiler folder with trailing slash (can be used instead of two vars above)\r
+        # VS160INSTALLPATH:  base install path on system to VC install dir.  Here you will find the VC folder, etc\r
+        # VS160TOOLVER:      version number for the VC compiler tools\r
+        # VS2019_PREFIX:     path to MSVC compiler folder with trailing slash (can be used instead of two vars above)\r
         elif thebuilder.env.GetValue("TOOL_CHAIN_TAG") == "VS2019":\r
 \r
             # check to see if full path already configured\r
@@ -70,11 +74,13 @@ class WindowsVsToolChain(IUefiBuildPlugin):
                 self.Logger.info("VS2019_PREFIX is already set.")\r
 \r
             else:\r
-                install_path = self._get_vs_install_path("VS2019".lower(), "VS160INSTALLPATH")\r
+                install_path = self._get_vs_install_path(\r
+                    "VS2019".lower(), "VS160INSTALLPATH")\r
                 vc_ver = self._get_vc_version(install_path, "VS160TOOLVER")\r
 \r
                 if install_path is None or vc_ver is None:\r
-                    self.Logger.error("Failed to configure environment for VS2019")\r
+                    self.Logger.error(\r
+                        "Failed to configure environment for VS2019")\r
                     return -1\r
 \r
                 version_aggregator.GetVersionAggregator().ReportVersion(\r
@@ -82,8 +88,9 @@ class WindowsVsToolChain(IUefiBuildPlugin):
                 version_aggregator.GetVersionAggregator().ReportVersion(\r
                     "VC Version", vc_ver, version_aggregator.VersionTypes.TOOL)\r
 \r
-                #make VS2019_PREFIX to align with tools_def.txt\r
-                prefix = os.path.join(install_path, "VC", "Tools", "MSVC", vc_ver)\r
+                # make VS2019_PREFIX to align with tools_def.txt\r
+                prefix = os.path.join(install_path, "VC",\r
+                                      "Tools", "MSVC", vc_ver)\r
                 prefix = prefix + os.path.sep\r
                 shell_environment.GetEnvironment().set_shell_var("VS2019_PREFIX", prefix)\r
 \r
@@ -103,14 +110,16 @@ class WindowsVsToolChain(IUefiBuildPlugin):
             if rc == 0 and path is not None and os.path.exists(path):\r
                 self.Logger.debug("Found VS instance for %s", vs_version)\r
             else:\r
-                self.Logger.error("Failed to find VS instance with VsWhere (%d)" % rc)\r
+                self.Logger.error(\r
+                    "Failed to find VS instance with VsWhere (%d)" % rc)\r
         return path\r
 \r
     def _get_vc_version(self, path, varname):\r
         # check if already specified\r
         vc_ver = shell_environment.GetEnvironment().get_shell_var(varname)\r
         if (path is None):\r
-            self.Logger.critical("Failed to find Visual Studio tools.  Might need to check for VS install")\r
+            self.Logger.critical(\r
+                "Failed to find Visual Studio tools.  Might need to check for VS install")\r
             return vc_ver\r
         if(vc_ver is None):\r
             # Not specified...find latest\r
@@ -122,5 +131,3 @@ class WindowsVsToolChain(IUefiBuildPlugin):
             vc_ver = os.listdir(p2)[-1].strip()  # get last in list\r
             self.Logger.debug("Found VC Tool version is %s" % vc_ver)\r
         return vc_ver\r
-\r
-\r