Mercurial > ~astiob > upreckon > hgweb
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2.00/files.py Mon Jun 07 23:36:52 2010 +0000 @@ -0,0 +1,25 @@ +#!/usr/bin/python +# Copyright (c) 2010 Chortos-2 <chortos@inbox.lv> + +import os +tasknames = (os.path.curdir,) + +class Files(object): + __slots__ = 'name', 'paths' + stdpaths = '%/', '%/^:%/', '%/^:', 'tests/%/', 'tests/', '^:%/', '^:', '' + + def __init__(self, name, paths = stdpaths): + self.name = name + self.paths = paths + + def __iter__(self): + for path in paths: + p = getpath(path, self.name) + if isfile(p): + yield p + +def isfile(path): + return os.path.isfile(path) + +def getpath(path, name): + return path + name \ No newline at end of file