MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / ParseOption

Method ParseOption

BaseTools/Source/Python/Ecc/EccMain.py:298–342  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

296 # Parse options
297 #
298 def ParseOption(self):
299 (Options, Target) = self.EccOptionParser()
300
301 if Options.Workspace:
302 os.environ["WORKSPACE"] = Options.Workspace
303
304 # Check workspace environment
305 if "WORKSPACE" not in os.environ:
306 EdkLogger.error("ECC", BuildToolError.ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found",
307 ExtraData="WORKSPACE")
308 else:
309 EccGlobalData.gWorkspace = os.path.normpath(os.getenv("WORKSPACE"))
310 if not os.path.exists(EccGlobalData.gWorkspace):
311 EdkLogger.error("ECC", BuildToolError.FILE_NOT_FOUND, ExtraData="WORKSPACE = %s" % EccGlobalData.gWorkspace)
312 os.environ["WORKSPACE"] = EccGlobalData.gWorkspace
313 # Set log level
314 self.SetLogLevel(Options)
315
316 # Set other options
317 if Options.ConfigFile is not None:
318 self.ConfigFile = Options.ConfigFile
319 if Options.OutputFile is not None:
320 self.OutputFile = Options.OutputFile
321 if Options.ReportFile is not None:
322 self.ReportFile = Options.ReportFile
323 if Options.ExceptionFile is not None:
324 self.ExceptionFile = Options.ExceptionFile
325 if Options.Target is not None:
326 if not os.path.isdir(Options.Target):
327 EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Target [%s] does NOT exist" % Options.Target)
328 else:
329 EccGlobalData.gTarget = self.GetRealPathCase(os.path.normpath(Options.Target))
330 else:
331 EdkLogger.warn("Ecc", EdkLogger.ECC_ERROR, "The target source tree was not specified, using current WORKSPACE instead!")
332 EccGlobalData.gTarget = os.path.normpath(os.getenv("WORKSPACE"))
333 if Options.keepdatabase is not None:
334 self.IsInit = False
335 if Options.metadata is not None and Options.sourcecode is not None:
336 EdkLogger.error("ECC", BuildToolError.OPTION_CONFLICT, ExtraData="-m and -s can't be specified at one time")
337 if Options.metadata is not None:
338 self.ScanSourceCode = False
339 if Options.sourcecode is not None:
340 self.ScanMetaData = False
341 if Options.folders is not None:
342 self.OnlyScan = True
343
344 ## SetLogLevel
345 #

Callers 1

__init__Method · 0.95

Calls 4

EccOptionParserMethod · 0.95
SetLogLevelMethod · 0.95
GetRealPathCaseMethod · 0.95
errorMethod · 0.45

Tested by

no test coverage detected