Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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
Esempio n. 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)
Esempio n. 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
Esempio n. 9
0
def lsdir(dirname):
       if not isdir(dirname):
               print dirname, ': no such directory'
               return
       names = mac.listdir(dirname)
       lsfiles(names, dirname)
Esempio n. 10
0
def expandglobword(word):
       names = glob.globlist(mac.listdir(':'), word)
       if not names: raise glob_error, 'no match for pattern ' + word
       return names
Esempio n. 11
0
def packall(outfp, dirname):
    names = mac.listdir(dirname)
    names.sort()
    packsome(outfp, dirname, names)
Esempio n. 12
0
def packall(outfp, dirname):
       names = mac.listdir(dirname)
       names.sort()
       packsome(outfp, dirname, names)