def main (): global options parser = optparse.OptionParser() parser.add_option("-d", "--data", dest="data", help="directory of input tree", metavar="DATA") parser.add_option("-v", "--verbose", action="count", dest="verbose", default=0, help="print status messages to stdout") (options, args) = parser.parse_args() build_util.walk_tree(options.data, add_ht)
def execute (args): # Read the template global basic_template basic_template = read_template('pydotorg') read_cache() if options.rebuilddirs and len(_cache) == 0: print >>sys.stderr, ("Cannot specify -R, --rebuilddirs unless " "a cache has been pre-built and specified with " "--cache") sys.exit(1) if options.erase_existing: if os.path.exists(options.out): log('Deleting existing %s directory', options.out) shutil.rmtree(options.out) if not os.path.exists(options.out): os.makedirs(options.out) start = time.time() # Copy resource directories if options.resources is not None: resources = options.resources.split(',') log('Copying resource directories: %s', resources) for rsrc in resources: dest_path = os.path.join(options.out, rsrc) if os.path.exists(dest_path): shutil.rmtree(dest_path) log('Removing resource directory %s; it already exists', rsrc, level=2) log('Copying resource directory %s', rsrc, level=2) log('Copying resource directory to %s', dest_path, level=2) copy_nosvn(rsrc, dest_path) # Rebuild all directories build_util.walk_tree(options.data, rebuild_directory, options.keepgoing) log('Total time for rebuild: %.1f sec', time.time()-start, level=1) save_cache() save_rss()