Пример #1
0
 def setup_errors(self, options, result):
     if options.use_listing_file:
         result.listing_file = Utils.replace_suffix(source, ".lis")
         path = result.listing_file
     else:
         path = None
     Errors.open_listing_file(path=path, echo_to_stderr=options.errors_to_stderr)
Пример #2
0
 def setup_errors(self, options):
     if options.use_listing_file:
         result.listing_file = Utils.replace_suffix(source, ".lis")
         Errors.open_listing_file(result.listing_file,
             echo_to_stderr = options.errors_to_stderr)
     else:
         Errors.open_listing_file(None)
Пример #3
0
 def setup_errors(self, options, result):
     Errors.reset()  # clear any remaining error state
     if options.use_listing_file:
         result.listing_file = Utils.replace_suffix(source, ".lis")
         path = result.listing_file
     else:
         path = None
     Errors.open_listing_file(path=path,
                              echo_to_stderr=options.errors_to_stderr)
Пример #4
0
 def read_dependency_file(self, source_path):
     dep_path = Utils.replace_suffix(source_path, ".dep")
     if os.path.exists(dep_path):
         f = open(dep_path, "rU")
         chunks = [line.strip().split(" ", 1) for line in f.readlines() if " " in line.strip()]
         f.close()
         return chunks
     else:
         return ()
Пример #5
0
 def read_dependency_file(self, source_path):
     dep_path = Utils.replace_suffix(source_path, ".dep")
     if os.path.exists(dep_path):
         f = open(dep_path, "rU")
         chunks = [ line.strip().split(" ", 1)
                    for line in f.readlines()
                    if " " in line.strip() ]
         f.close()
         return chunks
     else:
         return ()
Пример #6
0
Файл: Main.py Проект: jpe/cython
 def c_file_out_of_date(self, source_path):
     c_path = Utils.replace_suffix(source_path, ".c")
     if not os.path.exists(c_path):
         return 1
     c_time = Utils.modification_time(c_path)
     if Utils.file_newer_than(source_path, c_time):
         return 1
     pos = [source_path]
     pxd_path = Utils.replace_suffix(source_path, ".pxd")
     if os.path.exists(pxd_path) and Utils.file_newer_than(pxd_path, c_time):
         return 1
     for kind, name in self.read_dependency_file(source_path):
         if kind == "cimport":
             dep_path = self.find_pxd_file(name, pos)
         elif kind == "include":
             dep_path = self.search_include_directories(name, pos)
         else:
             continue
         if dep_path and Utils.file_newer_than(dep_path, c_time):
             return 1
     return 0
Пример #7
0
 def c_file_out_of_date(self, source_path):
     c_path = Utils.replace_suffix(source_path, ".c")
     if not os.path.exists(c_path):
         return 1
     c_time = Utils.modification_time(c_path)
     if Utils.file_newer_than(source_path, c_time):
         return 1
     pos = [source_path]
     pxd_path = Utils.replace_suffix(source_path, ".pxd")
     if os.path.exists(pxd_path) and Utils.file_newer_than(pxd_path, c_time):
         return 1
     for kind, name in self.read_dependency_file(source_path):
         if kind == "cimport":
             dep_path = self.find_pxd_file(name, pos)
         elif kind == "include":
             dep_path = self.search_include_directories(name, pos)
         else:
             continue
         if dep_path and Utils.file_newer_than(dep_path, c_time):
             return 1
     return 0
Пример #8
0
Файл: Main.py Проект: jpe/cython
def create_default_resultobj(compilation_source, options):
    result = CompilationResult()
    result.main_source_file = compilation_source.source_desc.filename
    result.compilation_source = compilation_source
    source_desc = compilation_source.source_desc
    if options.output_file:
        result.c_file = os.path.join(compilation_source.cwd, options.output_file)
    else:
        if options.cplus:
            c_suffix = ".cpp"
        else:
            c_suffix = ".c"
        result.c_file = Utils.replace_suffix(source_desc.filename, c_suffix)
    return result
Пример #9
0
def create_default_resultobj(compilation_source, options):
    result = CompilationResult()
    result.main_source_file = compilation_source.source_desc.filename
    result.compilation_source = compilation_source
    source_desc = compilation_source.source_desc
    if options.output_file:
        result.c_file = os.path.join(compilation_source.cwd, options.output_file)
    else:
        if options.cplus:
            c_suffix = ".cpp"
        else:
            c_suffix = ".c"
        result.c_file = Utils.replace_suffix(source_desc.filename, c_suffix)
    return result