Thanks, this is a superior implementation imho. -Mark
Dylan Baker <[email protected]> writes: > + > +def safe_makedirs(dirs): > + """A safe function for creating a directory tree. > + > + This function wraps os.makedirs, and provides a couple of sanity checks, > + first, if the directory already exists it doesn't try to create it, and > + second if the directory comes into existence between the check and > creation > + time (like if another generator creates it) then the exception will be > + caught. > + > + """ > + if not os.path.exists(dirs): > + try: > + os.makedirs(dirs) > + except OSError as e: > + if e.errno == errno.EEXIST: > + pass > + raise _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
