view 2.00/files.py @ 20:5bfa23cd638d

More ZIP archive fixes One typo and one Windows incompatibility fixed.
author Oleg Oshmyan <chortos@inbox.lv>
date Mon, 14 Jun 2010 21:02:06 +0000
parents f2279b7602d3
children ec6f1a132109
line wrap: on
line source

#!/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