Changeset 169
- Timestamp:
- 03/22/06 13:25:55 (3 years ago)
- Files:
-
- trunk/pyramid/build.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/pyramid/build.py
r168 r169 11 11 import shutil 12 12 import syck 13 import traceback 13 14 from os.path import join as opjoin 14 15 … … 35 36 def build(data, out, verbose=0, resourcedirs=[], rebuilddirs=None, 36 37 partialbuild=False, constants=None, update=False, 37 createcache=False ):38 createcache=False, keepgoing=False): 38 39 39 40 DATADIR = os.path.abspath(data) … … 131 132 132 133 133 if os.path.exists( cachepath) and partialbuild:134 if os.path.exists(cachepath) and partialbuild: 134 135 ctx = pickle.load(open(cachepath)) 135 136 ctx.partialbuild = True 136 html = flat.flatten( [DOCTYPE,137 flatten(ctx.data[ctx.relpath]['index.yml'], ctx)])137 html = flat.flatten([DOCTYPE, 138 flatten(ctx.data[ctx.relpath]['index.yml'], ctx)]) 138 139 file(opjoin(OUTPUTDIR, root, 'index.html'), 'w').write(html) 139 140 else: … … 148 149 149 150 try: 150 html = flat.flatten( [DOCTYPE,151 html = flat.flatten([DOCTYPE, 151 152 flatten(Y.fragmentConstructor( 152 opjoin(root, 'index.yml')), ctx)] )153 opjoin(root, 'index.yml')), ctx)]) 153 154 except KeyError: 154 155 print '*'*80 … … 160 161 161 162 sys.exit() 163 except (KeyboardInterrupt, SystemExit): # roll on Python2.5 164 raise 165 except: 166 print "While building %s:"%(opjoin(OUTPUTDIR, root)) 167 if not keepgoing: 168 raise 169 else: 170 ee, ev, et = sys.exc_info() 171 traceback.print_exception(ee, ev, et, file=sys.stdout) 172 print "keepgoing (-k) specified, continuing" 173 continue 174 162 175 163 176 file(opjoin(OUTPUTDIR, root, 'index.html'), 'w').write(html) … … 192 205 constants = None 193 206 194 195 207 build(options.data, options.out, verbose=options.verbose, 196 208 resourcedirs=resourcedirs, rebuilddirs=rebuilddirs, 197 209 constants=constants, update=options.update, 198 createcache=options.createcache )210 createcache=options.createcache, keepgoing=options.keepgoing) 199 211 200 212 … … 226 238 help="pass in the names constants (e.g. PDO=/root/pdo,PSF=/psf", 227 239 metavar="CONSTANTS") 240 parser.add_option("-k", "--keepgoing", dest="keepgoing", 241 action="store_true", default=False, 242 help="keep going past errors if possible", 243 metavar="KEEPGOING") 228 244 parser.add_option("-U", "--update", action="store_true", dest="update", 229 245 default=False,
