view 2.00/files.py @ 19:d4fc9341664e 1.20.2

Fixed an exception when tests.zip contained test cases in its root
author Oleg Oshmyan <chortos@inbox.lv>
date Sun, 13 Jun 2010 12:46:49 +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