def packnotolder(outfp, dirname, oldest): names = mac.listdir(dirname) oldest = macpath.cat(dirname, oldest) st = mac.stat(oldest) mtime = st[ST_MTIME] todo = [] for name in names: print name, '...', st = mac.stat(macpath.cat(dirname, name)) if st[ST_MTIME] >= mtime: print 'Yes.' todo.append(name) else: print 'No.' todo.sort() packsome(outfp, dirname, todo)
def lsfiles(names, dirname): names = names[:] # Make a copy so we can modify it for i in range(len(names)): name = names[i] if isdir(macpath.cat(dirname, name)): names[i] = ':' + name + ':' columnize(names)
def glob(pathname): if not has_magic(pathname): return [pathname] dirname, basename = macpath.split(pathname) if has_magic(dirname): if dirname[-1:] = ':': dirname = dirname[:-1] list = glob(dirname) else: list = [dirname] if not has_magic(basename): result = [] for dirname in list: if basename or macpath.isdir(dirname): name = macpath.cat(dirname, basename) if macpath.exists(name): result.append(name) else: result = [] for dirname in list: sublist = glob1(dirname, basename) for name in sublist: result.append(macpath.cat(dirname, name)) return result
def _stat(name): name = macpath.cat(cwd, name) if cache.has_key(name): return cache[name] if macpath.isfile(name): cache[name] = FILE return FILE try: list = mac.listdir(name) except: cache[name] = NONE return NONE cache[name] = list if name[-1:] = ':': cache[name[:-1]] = list else: cache[name+':'] = list return list
def packsome(outfp, dirname, names): for name in names: print name file = macpath.cat(dirname, name) pack(outfp, file, name)