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

Function Main

BaseTools/Source/Python/Trim/Trim.py:499–544  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

497# @retval 1 Tool failed
498#
499def Main():
500 try:
501 EdkLogger.Initialize()
502 CommandOptions, InputFile = Options()
503 if CommandOptions.LogLevel < EdkLogger.DEBUG_9:
504 EdkLogger.SetLevel(CommandOptions.LogLevel + 1)
505 else:
506 EdkLogger.SetLevel(CommandOptions.LogLevel)
507 except FatalError as X:
508 return 1
509
510 try:
511 if CommandOptions.FileType == "Vfr":
512 if CommandOptions.OutputFile is None:
513 CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii'
514 TrimPreprocessedVfr(InputFile, CommandOptions.OutputFile)
515 elif CommandOptions.FileType == "Asl":
516 if CommandOptions.OutputFile is None:
517 CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii'
518 TrimAslFile(InputFile, CommandOptions.OutputFile, CommandOptions.IncludePathFile)
519 elif CommandOptions.FileType == "VfrOffsetBin":
520 GenerateVfrBinSec(CommandOptions.ModuleName, CommandOptions.DebugDir, CommandOptions.OutputFile)
521 else :
522 if CommandOptions.OutputFile is None:
523 CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii'
524 TrimPreprocessedFile(InputFile, CommandOptions.OutputFile, CommandOptions.ConvertHex, CommandOptions.TrimLong)
525 except FatalError as X:
526 import platform
527 import traceback
528 if CommandOptions is not None and CommandOptions.LogLevel <= EdkLogger.DEBUG_9:
529 EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())
530 return 1
531 except:
532 import traceback
533 import platform
534 EdkLogger.error(
535 "\nTrim",
536 CODE_ERROR,
537 "Unknown fatal error when trimming [%s]" % InputFile,
538 ExtraData="\n(Please send email to %s for help, attaching following call stack trace!)\n" % MSG_EDKII_MAIL_ADDR,
539 RaiseError=False
540 )
541 EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())
542 return 1
543
544 return 0
545
546if __name__ == '__main__':
547 r = Main()

Callers 1

Trim.pyFile · 0.70

Calls 7

TrimPreprocessedVfrFunction · 0.85
TrimAslFileFunction · 0.85
GenerateVfrBinSecFunction · 0.85
TrimPreprocessedFileFunction · 0.85
InitializeMethod · 0.80
OptionsFunction · 0.70
errorMethod · 0.45

Tested by

no test coverage detected