Exemple #1
0
def walk(top, func, arg):
    try:
        names = mac.listdir(top)
    except mac.error:
        return
    func(arg, top, names)
    for name in names:
        name = join(top, name)
        if isdir(name):
            walk(name, func, arg)
Exemple #2
0
def glob1(dirname, pattern):
       if not dirname: dirname = ':'
       try:
               names = mac.listdir(dirname)
       except mac.error:
               return []
       result = []
       for name in names:
               if name[0] <> '.' or pattern[0] = '.':
                       if fnmatch.fnmatch(name, pattern): result.append(name)
Exemple #3
0
def glob1(dirname, pattern):
	if not dirname: dirname = ':'
	try:
		names = mac.listdir(dirname)
	except mac.error:
		return []
	result = []
	for name in names:
		if name[0] <> '.' or pattern[0] = '.':
			if fnmatch.fnmatch(name, pattern): result.append(name)
Exemple #4
0
def walk(top, func, arg):
	try:
		names = mac.listdir(top)
	except mac.error:
		return
	func(arg, top, names)
	for name in names:
		name = join(top, name)
		if isdir(name):
			walk(name, func, arg)
Exemple #5
0
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)
Exemple #6
0
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
Exemple #7
0
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)
Exemple #8
0
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
Exemple #9
0
def lsdir(dirname):
       if not isdir(dirname):
               print dirname, ': no such directory'
               return
       names = mac.listdir(dirname)
       lsfiles(names, dirname)
Exemple #10
0
def expandglobword(word):
       names = glob.globlist(mac.listdir(':'), word)
       if not names: raise glob_error, 'no match for pattern ' + word
       return names
Exemple #11
0
def packall(outfp, dirname):
    names = mac.listdir(dirname)
    names.sort()
    packsome(outfp, dirname, names)
Exemple #12
0
def packall(outfp, dirname):
       names = mac.listdir(dirname)
       names.sort()
       packsome(outfp, dirname, names)