Exemplo n.º 1
0
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)
Exemplo n.º 2
0
 def getcode(self):
     compiledfile = nucfiles.find_nuc(self.filename)
     if compiledfile is not None:
         self.filename = compiledfile
         return code_from_nuc(compiledfile)
     return code_from_nu(self.filename, self.f)