comparison 2.00/files.py @ 16:f2279b7602d3

Initial 2.00 commit
author Oleg Oshmyan <chortos@inbox.lv>
date Mon, 07 Jun 2010 23:36:52 +0000
parents
children ec6f1a132109
comparison
equal deleted inserted replaced
15:c0e925ae721e 16:f2279b7602d3
1 #!/usr/bin/python
2 # Copyright (c) 2010 Chortos-2 <chortos@inbox.lv>
3
4 import os
5 tasknames = (os.path.curdir,)
6
7 class Files(object):
8 __slots__ = 'name', 'paths'
9 stdpaths = '%/', '%/^:%/', '%/^:', 'tests/%/', 'tests/', '^:%/', '^:', ''
10
11 def __init__(self, name, paths = stdpaths):
12 self.name = name
13 self.paths = paths
14
15 def __iter__(self):
16 for path in paths:
17 p = getpath(path, self.name)
18 if isfile(p):
19 yield p
20
21 def isfile(path):
22 return os.path.isfile(path)
23
24 def getpath(path, name):
25 return path + name