def execfile(nu_file): """Execute the given noodle source, or its associated compiled-bytecode file if one is found with the same timestamp. Returns the exit code. """ nucname = nucfiles.find_nuc(nu_file) if nucname is not None: return run_noodle(nucfiles.nuc_code_object(nucname)) # Either no .nuc, or timestamps don't match codeobj = noodle_compile_file(nu_file) try: nucfiles.output_nuc(nu_file, codeobj, nucname) except IOError: pass return run_noodle(codeobj)
def code_from_nuc(instream): return nucfiles.nuc_code_object(instream)