本文整理汇总了Python中lib.Functions.Exit.exit方法的典型用法代码示例。如果您正苦于以下问题:Python Exit.exit方法的具体用法?Python Exit.exit怎么用?Python Exit.exit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.Functions.Exit
的用法示例。
在下文中一共展示了Exit.exit方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: HandleListNetlist
# 需要导入模块: from lib.Functions import Exit [as 别名]
# 或者: from lib.Functions.Exit import exit [as 别名]
def HandleListNetlist(self, args):
self.PrintHeadline()
self.__PrepareForSynthesis()
if (args.NetlistKind is None):
nlFilter = NetlistKind.All
else:
nlFilter = NetlistKind.Unknown
for kind in args.TestbenchKind.lower().split(","):
if (kind == "lattice"): nlFilter |= NetlistKind.LatticeNetlist
elif (kind == "quartus"): nlFilter |= NetlistKind.QuartusNetlist
elif (kind == "xst"): nlFilter |= NetlistKind.XstNetlist
elif (kind == "coregen"): nlFilter |= NetlistKind.CoreGeneratorNetlist
elif (kind == "vivado"): nlFilter |= NetlistKind.VivadoNetlist
else: raise CommonException("Argument --kind has an unknown value '{0}'.".format(kind))
fqnList = self._ExtractFQNs(args.FQN)
for fqn in fqnList:
entity = fqn.Entity
if (isinstance(entity, WildCard)):
for testbench in entity.GetNetlists(nlFilter):
print(str(testbench))
else:
testbench = entity.GetNetlists(nlFilter)
print(str(testbench))
Exit.exit()
示例2: HandleHelp
# 需要导入模块: from lib.Functions import Exit [as 别名]
# 或者: from lib.Functions.Exit import exit [as 别名]
def HandleHelp(self, args):
self.PrintHeadline()
if (args.Command is None):
self.MainParser.print_help()
Exit.exit()
elif (args.Command == "help"):
print("This is a recursion ...")
else:
self.SubParsers[args.Command].print_help()
Exit.exit()
示例3: HandleQueryConfiguration
# 需要导入模块: from lib.Functions import Exit [as 别名]
# 或者: from lib.Functions.Exit import exit [as 别名]
def HandleQueryConfiguration(self, args):
self.__PrepareForConfiguration()
query = Query(self)
try:
result = query.QueryConfiguration(args.Query)
print(result, end="")
Exit.exit()
except ConfigurationException as ex:
print(str(ex), end="")
Exit.exit(1)
示例4: main
# 需要导入模块: from lib.Functions import Exit [as 别名]
# 或者: from lib.Functions.Exit import exit [as 别名]
def main():
dryRun = "-D" in sys_argv
debug = "-d" in sys_argv
verbose = "-v" in sys_argv
quiet = "-q" in sys_argv
# configure Exit class
Exit.quiet = quiet
try:
Init.init()
# handover to a class instance
poc = PoC(debug, verbose, quiet, dryRun)
poc.Run()
Exit.exit()
except (CommonException, ConfigurationException, SimulatorException, CompilerException) as ex:
print("{RED}ERROR:{NOCOLOR} {message}".format(message=ex.message, **Init.Foreground))
cause = ex.__cause__
if isinstance(cause, FileNotFoundError):
print("{YELLOW} FileNotFound:{NOCOLOR} '{cause}'".format(cause=str(cause), **Init.Foreground))
elif isinstance(cause, NotADirectoryError):
print("{YELLOW} NotADirectory:{NOCOLOR} '{cause}'".format(cause=str(cause), **Init.Foreground))
elif isinstance(cause, DuplicateOptionError):
print("{YELLOW} DuplicateOptionError:{NOCOLOR} '{cause}'".format(cause=str(cause), **Init.Foreground))
elif isinstance(cause, ConfigParser_Error):
print("{YELLOW} configparser.Error:{NOCOLOR} '{cause}'".format(cause=str(cause), **Init.Foreground))
elif isinstance(cause, ParserException):
print("{YELLOW} ParserException:{NOCOLOR} {cause}".format(cause=str(cause), **Init.Foreground))
cause = cause.__cause__
if (cause is not None):
print("{YELLOW} {name}:{NOCOLOR} {cause}".format(name=cause.__class__.__name__, cause= str(cause), **Init.Foreground))
elif isinstance(cause, ToolChainException):
print("{YELLOW} {name}:{NOCOLOR} {cause}".format(name=cause.__class__.__name__, cause=str(cause), **Init.Foreground))
cause = cause.__cause__
if (cause is not None):
if isinstance(cause, OSError):
print("{YELLOW} {name}:{NOCOLOR} {cause}".format(name=cause.__class__.__name__, cause=str(cause), **Init.Foreground))
else:
print(" Possible causes:")
print(" - The compile order is broken.")
print(" - A source file was not compiled and an old file got used.")
if (not (verbose or debug)):
print()
print("{CYAN} Use '-v' for verbose or '-d' for debug to print out extended messages.{NOCOLOR}".format(**Init.Foreground))
Exit.exit(1)
except EnvironmentException as ex: Exit.printEnvironmentException(ex)
except NotConfiguredException as ex: Exit.printNotConfiguredException(ex)
except PlatformNotSupportedException as ex: Exit.printPlatformNotSupportedException(ex)
except ExceptionBase as ex: Exit.printExceptionbase(ex)
except NotImplementedError as ex: Exit.printNotImplementedError(ex)
except Exception as ex: Exit.printException(ex)
示例5: HandleVivadoCompilation
# 需要导入模块: from lib.Functions import Exit [as 别名]
# 或者: from lib.Functions.Exit import exit [as 别名]
def HandleVivadoCompilation(self, args):
self.PrintHeadline()
self.__PrepareForSynthesis()
self._CheckVivadoEnvironment()
fqnList = self._ExtractFQNs(args.FQN, defaultType=EntityTypes.NetList)
board = self._ExtractBoard(args.BoardName, args.DeviceName, force=True)
compiler = VivadoCompiler(self, self.DryRun, args.NoCleanUp)
compiler.RunAll(fqnList, board)
Exit.exit()
示例6: HandleQuestaSimulation
# 需要导入模块: from lib.Functions import Exit [as 别名]
# 或者: from lib.Functions.Exit import exit [as 别名]
def HandleQuestaSimulation(self, args):
self.PrintHeadline()
self.__PrepareForSimulation()
fqnList = self._ExtractFQNs(args.FQN)
board = self._ExtractBoard(args.BoardName, args.DeviceName)
vhdlVersion = self._ExtractVHDLVersion(args.VHDLVersion)
simulator = QuestaSimulator(self, args.GUIMode)
allPassed = simulator.RunAll(fqnList, board=board, vhdlVersion=vhdlVersion) # , vhdlGenerics=None)
Exit.exit(0 if allPassed else 1)
示例7: HandleISESimulation
# 需要导入模块: from lib.Functions import Exit [as 别名]
# 或者: from lib.Functions.Exit import exit [as 别名]
def HandleISESimulation(self, args):
self.PrintHeadline()
self.__PrepareForSimulation()
self._CheckISEEnvironment()
fqnList = self._ExtractFQNs(args.FQN)
board = self._ExtractBoard(args.BoardName, args.DeviceName)
simulator = ISESimulator(self, args.GUIMode)
allPassed = simulator.RunAll(fqnList, board=board, vhdlVersion=VHDLVersion.VHDL93) #, vhdlGenerics=None)
Exit.exit(0 if allPassed else 1)
示例8: HandleActiveHDLSimulation
# 需要导入模块: from lib.Functions import Exit [as 别名]
# 或者: from lib.Functions.Exit import exit [as 别名]
def HandleActiveHDLSimulation(self, args):
self.PrintHeadline()
self.__PrepareForSimulation()
fqnList = self._ExtractFQNs(args.FQN)
board = self._ExtractBoard(args.BoardName, args.DeviceName)
vhdlVersion = self._ExtractVHDLVersion(args.VHDLVersion)
# create a GHDLSimulator instance and prepare it
simulator = ActiveHDLSimulator(self, self.DryRun, args.GUIMode)
allPassed = simulator.RunAll(fqnList, board=board, vhdlVersion=vhdlVersion) # , vhdlGenerics=None)
Exit.exit(0 if allPassed else 1)
示例9: HandleVivadoSimulation
# 需要导入模块: from lib.Functions import Exit [as 别名]
# 或者: from lib.Functions.Exit import exit [as 别名]
def HandleVivadoSimulation(self, args):
self.PrintHeadline()
self.__PrepareForSimulation()
self._CheckVivadoEnvironment()
fqnList = self._ExtractFQNs(args.FQN)
board = self._ExtractBoard(args.BoardName, args.DeviceName)
# FIXME: VHDL-2008 is broken in Vivado 2016.1 -> use VHDL-93 by default
vhdlVersion = self._ExtractVHDLVersion(args.VHDLVersion, defaultVersion=VHDLVersion.VHDL93)
simulator = VivadoSimulator(self, args.GUIMode)
allPassed = simulator.RunAll(fqnList, board=board, vhdlVersion=vhdlVersion) # , vhdlGenerics=None)
Exit.exit(0 if allPassed else 1)
示例10: HandleCocotbSimulation
# 需要导入模块: from lib.Functions import Exit [as 别名]
# 或者: from lib.Functions.Exit import exit [as 别名]
def HandleCocotbSimulation(self, args):
self.PrintHeadline()
self.__PrepareForSimulation()
# check if QuestaSim is configured
if (len(self.PoCConfig.options("INSTALL.Mentor.QuestaSim")) == 0):
raise NotConfiguredException("Mentor QuestaSim is not configured on this system.")
fqnList = self._ExtractFQNs(args.FQN)
board = self._ExtractBoard(args.BoardName, args.DeviceName)
# create a CocotbSimulator instance and prepare it
simulator = CocotbSimulator(self, args.GUIMode)
allPassed = simulator.RunAll(fqnList, board=board, vhdlVersion=VHDLVersion.VHDL08)
Exit.exit(0 if allPassed else 1)
示例11: HandleGHDLSimulation
# 需要导入模块: from lib.Functions import Exit [as 别名]
# 或者: from lib.Functions.Exit import exit [as 别名]
def HandleGHDLSimulation(self, args):
self.PrintHeadline()
self.__PrepareForSimulation()
config = GHDLConfiguration(self)
if (not config.IsSupportedPlatform()): raise PlatformNotSupportedException()
if (not config.IsConfigured()): raise NotConfiguredException("GHDL is not configured on this system.")
fqnList = self._ExtractFQNs(args.FQN)
board = self._ExtractBoard(args.BoardName, args.DeviceName)
vhdlVersion = self._ExtractVHDLVersion(args.VHDLVersion)
simulator = GHDLSimulator(self, args.GUIMode)
allPassed = simulator.RunAll(fqnList, board=board, vhdlVersion=vhdlVersion, guiMode=args.GUIMode) #, vhdlGenerics=None)
Exit.exit(0 if allPassed else 1)
示例12: HandleDefault
# 需要导入模块: from lib.Functions import Exit [as 别名]
# 或者: from lib.Functions.Exit import exit [as 别名]
def HandleDefault(self, _):
self.PrintHeadline()
# print("Common arguments:")
# for funcname,func in CommonArgumentAttribute.GetMethods(self):
# for comAttribute in CommonArgumentAttribute.GetAttributes(func):
# print(" {0} {1}".format(comAttribute.Args, comAttribute.KWArgs['help']))
#
# self.__mainParser.add_argument(*(comAttribute.Args), **(comAttribute.KWArgs))
#
# for funcname,func in CommonSwitchArgumentAttribute.GetMethods(self):
# for comAttribute in CommonSwitchArgumentAttribute.GetAttributes(func):
# print(" {0} {1}".format(comAttribute.Args, comAttribute.KWArgs['help']))
self.MainParser.print_help()
Exit.exit()
示例13: HandleListTestbenches
# 需要导入模块: from lib.Functions import Exit [as 别名]
# 或者: from lib.Functions.Exit import exit [as 别名]
def HandleListTestbenches(self, args):
self.PrintHeadline()
self.__PrepareForSimulation()
defaultLibrary = "PoC"
if (args.SolutionID is not None):
solutionName = args.SolutionID
print("Solution name: {0}".format(solutionName))
if self.PoCConfig.has_option("SOLUTION.Solutions", solutionName):
sectionName = "SOLUTION.{0}".format(solutionName)
print("Found registered solution:")
print(" Name: {0}".format(self.PoCConfig[sectionName]['Name']))
print(" Path: {0}".format(self.PoCConfig[sectionName]['Path']))
solutionRootPath = self.Directories.Root / self.PoCConfig[sectionName]['Path']
solutionConfigFile = solutionRootPath / ".PoC" / "solution.config.ini"
solutionDefaultsFile = solutionRootPath / ".PoC" / "solution.defaults.ini"
print(" sln files: {0!s} {1!s}".format(solutionConfigFile, solutionDefaultsFile))
self._LogVerbose("Reading solution file...")
self._LogDebug(" {0!s}".format(solutionConfigFile))
self._LogDebug(" {0!s}".format(solutionDefaultsFile))
if not solutionConfigFile.exists():
raise NotConfiguredException("Solution's {0} configuration file '{1!s}' does not exist.".format(solutionName, solutionConfigFile)) \
from FileNotFoundError(str(solutionConfigFile))
if not solutionDefaultsFile.exists():
raise NotConfiguredException("Solution's {0} defaults file '{1!s}' does not exist.".format(solutionName, solutionDefaultsFile)) \
from FileNotFoundError(str(solutionDefaultsFile))
self.__pocConfig.read(str(solutionConfigFile))
self.__pocConfig.read(str(solutionDefaultsFile))
section = self.PoCConfig['PROJECT.Projects']
defaultLibrary = section['DefaultLibrary']
print("Solution:")
print(" Name: {0}".format(section['Name']))
print(" Default library: {0}".format(defaultLibrary))
print(" Projects:")
for item in section:
if (section[item] in ["PoCProject", "ISEProject", "VivadoProject", "QuartusProject"]):
sectionName2 = "PROJECT.{0}".format(item)
print(" {0}".format(self.PoCConfig[sectionName2]['Name']))
print(" Namespace roots:")
for item in section:
if (section[item] == "Library"):
libraryPrefix = item
print(" {0: <16} {1}".format(self.PoCConfig[libraryPrefix]['Name'], libraryPrefix))
self.Root.AddLibrary(libraryPrefix, libraryPrefix)
if (args.TestbenchKind is None):
tbFilter = TestbenchKind.All
else:
tbFilter = TestbenchKind.Unknown
for kind in args.TestbenchKind.lower().split(","):
if (kind == "vhdl"): tbFilter |= TestbenchKind.VHDLTestbench
elif (kind == "cocotb"): tbFilter |= TestbenchKind.CocoTestbench
else: raise CommonException("Argument --kind has an unknown value '{0}'.".format(kind))
fqnList = self._ExtractFQNs(args.FQN, defaultLibrary)
for fqn in fqnList:
self._LogNormal("")
entity = fqn.Entity
if (isinstance(entity, WildCard)):
for testbench in entity.GetTestbenches(tbFilter):
print(str(testbench))
else:
testbench = entity.GetTestbenches(tbFilter)
print(str(testbench))
Exit.exit()
示例14: HandleQueryConfiguration
# 需要导入模块: from lib.Functions import Exit [as 别名]
# 或者: from lib.Functions.Exit import exit [as 别名]
def HandleQueryConfiguration(self, args):
self.__PrepareForConfiguration()
query = Query(self)
result = query.QueryConfiguration(args.Query)
print(result, end="")
Exit.exit()