本文整理汇总了Python中lib.Functions.Exit类的典型用法代码示例。如果您正苦于以下问题:Python Exit类的具体用法?Python Exit怎么用?Python Exit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Exit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: HandleListNetlist
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
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
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: HandleISESimulation
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)
示例5: HandleQuestaSimulation
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)
示例6: HandleVivadoCompilation
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()
示例7: HandleActiveHDLSimulation
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)
示例8: HandleVivadoSimulation
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)
示例9: HandleDefault
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()
示例10: HandleGHDLSimulation
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)
示例11: HandleCocotbSimulation
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)
示例12: print
from configparser import Error
print(Fore.RED + "ERROR:" + Fore.RESET + " %s" % ex.message)
if isinstance(ex.__cause__, FileNotFoundError):
print(Fore.YELLOW + " FileNotFound:" + Fore.RESET + " '%s'" % str(ex.__cause__))
elif isinstance(ex.__cause__, Error):
print(Fore.YELLOW + " configparser.Error:" + Fore.RESET + " %s" % str(ex.__cause__))
print(Fore.RESET + Back.RESET + Style.RESET_ALL)
exit(1)
except EnvironmentException as ex:
Exit.printEnvironmentException(ex)
except NotConfiguredException as ex:
Exit.printNotConfiguredException(ex)
except PlatformNotSupportedException as ex:
Exit.printPlatformNotSupportedException(ex)
except BaseException as ex:
Exit.printBaseException(ex)
except NotImplementedException as ex:
Exit.printNotImplementedException(ex)
except Exception as ex:
Exit.printException(ex)
# entry point
if __name__ == "__main__":
Exit.versionCheck((3, 4, 0))
main()
else:
Exit.printThisIsNoLibraryFile(Testbench.headLine)
示例13: main
def main():
from colorama import Fore, Back, Style, init
init()
print(Fore.MAGENTA + "=" * 80)
print("{: ^80s}".format(Testbench.headLine))
print("=" * 80)
print(Fore.RESET + Back.RESET + Style.RESET_ALL)
try:
import argparse
import textwrap
# create a commandline argument parser
argParser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description=textwrap.dedent(
"""\
This is the PoC Library Testbench Service Tool.
"""
),
add_help=False,
)
# add arguments
group1 = argParser.add_argument_group("Verbosity")
group1.add_argument(
"-D", help="enable script wrapper debug mode", action="store_const", const=True, default=False
)
group1.add_argument(
"-d", dest="debug", help="enable debug mode", action="store_const", const=True, default=False
)
group1.add_argument(
"-v", dest="verbose", help="print out detailed messages", action="store_const", const=True, default=False
)
group1.add_argument(
"-q", dest="quiet", help="run in quiet mode", action="store_const", const=True, default=False
)
group1.add_argument(
"-r", dest="showReport", help="show report", action="store_const", const=True, default=False
)
group1.add_argument("-l", dest="showLog", help="show logs", action="store_const", const=True, default=False)
group2 = argParser.add_argument_group("Commands")
group21 = group2.add_mutually_exclusive_group(required=True)
group21.add_argument(
"-h",
"--help",
dest="help",
help="show this help message and exit",
action="store_const",
const=True,
default=False,
)
group21.add_argument("--list", metavar="<Entity>", dest="list", help="list available testbenches")
group21.add_argument("--isim", metavar="<Entity>", dest="isim", help="use Xilinx ISE Simulator (isim)")
group21.add_argument("--xsim", metavar="<Entity>", dest="xsim", help="use Xilinx Vivado Simulator (xsim)")
group21.add_argument("--vsim", metavar="<Entity>", dest="vsim", help="use Mentor Graphics Simulator (vsim)")
group21.add_argument("--ghdl", metavar="<Entity>", dest="ghdl", help="use GHDL Simulator (ghdl)")
group3 = argParser.add_argument_group("Options")
group3.add_argument(
"--std", metavar="<version>", dest="std", help="set VHDL standard [87,93,02,08]; default=93"
)
# group3.add_argument('-i', '--interactive', dest="interactive", help='start simulation in interactive mode', action='store_const', const=True, default=False)
group3.add_argument(
"-g",
"--gui",
dest="gui",
help="start simulation in gui mode",
action="store_const",
const=True,
default=False,
)
# parse command line options
args = argParser.parse_args()
except Exception as ex:
Exit.printException(ex)
# create class instance and start processing
try:
test = Testbench(args.debug, args.verbose, args.quiet)
if args.help == True:
argParser.print_help()
print()
return
elif args.list is not None:
test.listSimulations(args.list)
elif args.isim is not None:
iSimGUIMode = args.gui
test.iSimSimulation(args.isim, args.showLog, args.showReport, iSimGUIMode)
elif args.xsim is not None:
xSimGUIMode = args.gui
test.xSimSimulation(args.xsim, args.showLog, args.showReport, xSimGUIMode)
elif args.vsim is not None:
if (args.std is not None) and (args.std in ["87", "93", "02", "08"]):
#.........这里部分代码省略.........
示例14: AldecException
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
#
# entry point
if __name__ != "__main__":
# place library initialization code here
pass
else:
from lib.Functions import Exit
Exit.printThisIsNoExecutableFile("The PoC-Library - Python Module ToolChains.Aldec.Aldec")
from Base.Configuration import Configuration as BaseConfiguration
from Base.ToolChain import ToolChainException
class AldecException(ToolChainException):
pass
class Configuration(BaseConfiguration):
_vendor = "Aldec"
_toolName = None # automatically configure only vendor path
_section = "INSTALL.Aldec"
_template = {
示例15: Compiler
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
#
# entry point
if __name__ != "__main__":
# place library initialization code here
pass
else:
from lib.Functions import Exit
Exit.printThisIsNoExecutableFile("The PoC-Library - Python Class Compiler(PoCCompiler)")
# load dependencies
from pathlib import Path
from Base.Exceptions import *
from Compiler.Base import PoCCompiler
from Compiler.Exceptions import *
class Compiler(PoCCompiler):
__executables = {}
def __init__(self, host, showLogs, showReport):
super(self.__class__, self).__init__(host, showLogs, showReport)