def compile_file(filename, ds, credentials=None): with open(filename, 'r') as source: sourceText = source.read() appname = appname_from_filename(filename) if ds: return calvin_dscodegen(sourceText, appname) else: return compile_script(sourceText, appname, credentials=credentials)
def compile_file(filename, ds, ir, credentials=None, include_paths=None): pp = Preprocessor(include_paths) sourceText, it = pp.process(filename) if it.error_count > 0: return ({}, it) appname = appname_from_filename(filename) if ds: return calvin_dscodegen(sourceText, appname) elif ir: return printable_ir(sourceText) else: return compile_script(sourceText, appname, credentials=credentials)
def compile_file(filename, credentials=None): with open(filename, 'r') as source: sourceText = source.read() appname = appname_from_filename(filename) return compile_script(sourceText, appname, credentials=credentials)
def compile_script(self, script, name): # Instead of rewriting tests after compiler.compile_script changed # from returning app_info, errors, warnings to app_info, issuetracker # use this stub in tests to keep old behaviour app_info, issuetracker = compiler.compile_script(script, name) return app_info, issuetracker.errors(), issuetracker.warnings()