예제 #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 __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")
예제 #4
0
 def __new__(cls, *args, **kwargs):
     return Capi2Core(*args, **kwargs)