comparison fetch.py @ 21:0706968f01bb

stub testing
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 09 Nov 2011 19:59:04 -0800
parents 738d84b4de52
children 12ad9ab11860
comparison
equal deleted inserted replaced
20:738d84b4de52 21:0706968f01bb
132 132
133 __all__ += [i.__name__ for i in fetchers] 133 __all__ += [i.__name__ for i in fetchers]
134 134
135 class Fetch(object): 135 class Fetch(object):
136 136
137 def __init__(self, fetchers, relative_to=None, strict=True): 137 def __init__(self, fetchers=fetchers[:], relative_to=None, strict=True):
138 self.fetchers = fetchers 138 self.fetchers = fetchers
139 self.relative_to = relative_to 139 self.relative_to = relative_to
140 self.strict = strict 140 self.strict = strict
141 141
142 def fetcher(self, _type): 142 def fetcher(self, _type):
167 relative_to = self.relative_to or os.path.dirname(os.path.abspath(item['manifest'])) 167 relative_to = self.relative_to or os.path.dirname(os.path.abspath(item['manifest']))
168 dest = os.path.join(relative_to, dest) 168 dest = os.path.join(relative_to, dest)
169 169
170 # fetch the items 170 # fetch the items
171 self(item['url'], destination=dest, type=item['type'], **item['options']) 171 self(item['url'], destination=dest, type=item['type'], **item['options'])
172
172 173
173 format_string = "[URL] [destination] [type] <options>" 174 format_string = "[URL] [destination] [type] <options>"
174 def read_manifests(*manifests): 175 def read_manifests(*manifests):
175 """ 176 """
176 read some manifests and return the items 177 read some manifests and return the items