def use_xdr(dir, xdrfile): """Move to dir, and generate files based on xdr file""" os.chdir(dir) if needs_updating(xdrfile): xdrgen.run(xdrfile) for file in glob.glob(os.path.join(dir, 'parse*')): print("deleting", file) os.remove(file)
def expand_xdr(self, dir): cwd = os.getcwd() try: if dir: os.chdir(dir) xdr_files = glob(os.path.join(dir, "*.x")) for f in xdr_files: # Can conditionalize this # XXX need some way to pass options here xdrgen.run(f) finally: os.chdir(cwd)
def expand_xdr(self, dir): cwd = os.getcwd() try: if dir: os.chdir(dir) xdr_files = glob(os.path.join(dir, "*.x")) for f in xdr_files: # Can conditionalize this # XXX need some way to pass options here xdrgen.run(f) try: os.remove("parser.out") os.remove("parsetab.py") except: print "Remove parse* failed" finally: os.chdir(cwd)
def expand_xdr(self, dir): print("expand = %r" % dir) cwd = os.getcwd() xdrdir = os.path.join(cwd, dir, 'xdrdef') print("xdrdir = %r" % xdrdir) if os.path.exists(xdrdir): try: os.chdir(xdrdir) xdr_files = glob(os.path.join(xdrdir, "*.x")) for f in xdr_files: # Can conditionalize this # XXX need some way to pass options here xdrgen.run(f) try: os.remove("parser.out") os.remove("parsetab.py") except: print("Remove parse* failed") finally: os.chdir(cwd)