16
|
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 |