while True: lastlist = thelist thelist = list(walkemptydirs(dest)) if not thelist or lastlist == thelist: break for aDir in thelist: print 'Trimming "%s".' % aDir os.rmdir(aDir) # print "\nDone." if __name__ == "__main__": stand = None if log_file: stand = StandOut(logfile=log_file) time1 = time.time() try: # do the business main() except KeyboardInterrupt: sys.stderr.write("Exited by Keyboard Interrupt.\n") except Exception, e: # print any error without bombing out # (so we can display it, then close our files nicely) f = StringIO() print_exc(file=f) # write error to sys.stderr rather than printing to sys.stdout sys.stderr.write(f.getvalue() + "\n") else: print
if os.path.isfile('__dist__'): print 'Won\'t run from distribution directory.' print "Run 'make_dist.py' and use the distribution it creates." sys.exit(1) # config['defaults_directory'] = os.path.join( os.path.dirname(rest2web.__file__), 'defaults') # #FIXME: check this returns an integer threshold = THRESHOLD[options.get('verbosity', 0)] log_file = config['log_file'] or None if log_file: log_file = os.path.expanduser(log_file) # # create the 'logger' stand = StandOut(logfile=log_file) # Log *everything* to the file. stand.errThreshold = 1 stand.outLogfileThreshold = 1 # Set the normal output level, as per the command line option stand.outStreamThreshold = threshold # if istrue(config.get('psyco', 'False')): try: import psyco psyco.full() from psyco.classes import * except ImportError: out('Cannot find Psyco, skipping it', INFO) # options['typogrify'] = istrue(config.get('typogrify', 'True'))
if os.path.isfile('__dist__'): print 'Won\'t run from distribution directory.' print "Run 'make_dist.py' and use the distribution it creates." sys.exit(1) # config['defaults_directory'] = os.path.join( os.path.dirname(rest2web.__file__), 'defaults') # #FIXME: check this returns an integer threshold = THRESHOLD[options.get('verbosity', 0)] log_file = config['log_file'] or None if log_file: log_file = os.path.expanduser(log_file) # # create the 'logger' stand = StandOut(logfile=log_file) # Log *everything* to the file. stand.errThreshold = 1 stand.outLogfileThreshold = 1 # Set the normal output level, as per the command line option stand.outStreamThreshold = threshold # if istrue(config.get('psyco', 'False')): try: import psyco psyco.full() from psyco.classes import * except ImportError: out('Cannot find Psyco, skipping it', INFO) # out(versionstring, INFO)