コード例 #1
0
 def __new__(cls, *args, **kwargs):
     with open(args[0]) as f:
         l = f.readline().split()
         if l:
             first_line = l[0]
         else:
             first_line = ""
         if first_line == "CAPI=1":
             warnings.warn(
                 "The CAPI1 core file description format is deprecated and "
                 "will be removed in the next major version of FuseSoC. "
                 "Please port your core files to the CAPI2 format.",
                 FutureWarning,
             )
             return Capi1Core(*args, **kwargs)
         elif first_line == "CAPI=2:":
             return Capi2Core(*args, **kwargs)
         else:
             error_msg = 'The first line of the core file {} must be "CAPI=1" or "CAPI=2:".'.format(
                 args[0])
             error_msg += '  The first line of this core file is "{}".'.format(
                 first_line)
             if first_line == "CAPI=2":
                 error_msg += "  Just add a colon on the end!"
             logger.warning(error_msg)
             raise RuntimeError("Unknown file type")
コード例 #2
0
 def __new__(cls, *args, **kwargs):
     with open(args[0]) as f:
         first_line = f.readline().split()[0]
         if  first_line == 'CAPI=1':
             return Capi1Core(*args, **kwargs)
         elif first_line == 'CAPI=2:':
             return Capi2Core(*args, **kwargs)
         else:
             raise RuntimeError("Unknown file type")
コード例 #3
0
def open_core(capi1_file):
    with open(capi1_file) as f:
        first_line = f.readline().split()[0]
        if first_line == "CAPI=1":
            return Capi1Core(capi1_file)
        elif first_line == "SAPI=1":
            logger.error("You must specify a core file, not a system file")
        elif first_line == "CAPI=2:":
            logger.error("Input file must be in CAPI1 format")
        else:
            logger.error("Unknown file type")
    return 0
コード例 #4
0
 def __new__(cls, *args, **kwargs):
     with open(args[0]) as f:
         l = f.readline().split()
         if l:
             first_line = l[0]
         else:
             first_line = ""
         if first_line == "CAPI=1":
             return Capi1Core(*args, **kwargs)
         elif first_line == "CAPI=2:":
             return Capi2Core(*args, **kwargs)
         else:
             error_msg = 'The first line of the core file {} must be "CAPI=1" or "CAPI=2:".'.format(
                 args[0])
             error_msg += '  The first line of this core file is "{}".'.format(
                 first_line)
             if first_line == "CAPI=2":
                 error_msg += "  Just add a colon on the end!"
             logger.warning(error_msg)
             raise RuntimeError("Unknown file type")
コード例 #5
0
 def __new__(cls, *args, **kwargs):
     return Capi1Core(*args, **kwargs)