From: Fredrik Unger Date: Wed, 19 Dec 2012 09:17:28 +0000 (+0100) Subject: main: changes to time, commments X-Git-Url: https://source.tree.se/git?p=treecutter.git;a=commitdiff_plain;h=8e8fa071433cb48cc230ba74facbcfb644fa54c2 main: changes to time, commments Changed time.time() to time() by importing from time import time instead. Added some comments, can be improved. --- diff --git a/treecutter/main.py b/treecutter/main.py index b53a92f..92055d2 100644 --- a/treecutter/main.py +++ b/treecutter/main.py @@ -1,11 +1,12 @@ #!/usr/bin/python import os -import time +from time import time import argparse from treecutter.directory import Directory from treecutter.sitemap import Sitemap def main(): + parser = argparse.ArgumentParser(description='Process docbook article tree.') parser.add_argument('--style', nargs='?', default=os.path.dirname(os.getcwd())+'/style/default/') @@ -13,13 +14,16 @@ def main(): default=os.path.dirname(os.getcwd())+'/htdocs/') args = parser.parse_args() - ts = time.time() + ts = time() dir_ = Directory() sitemap = Sitemap() + # Scanning current directory and subdirectory for docbook articles dir_.scan() + # Reading the sitemap.txt building a Trie structure sitemap.read_map() + # Comparing the current state of the dir with the sitemap missing = dir_.set() - sitemap.set() removed = sitemap.set() - dir_.set() for page in removed: @@ -30,13 +34,16 @@ def main(): if len(missing)+len(removed) != 0: print 'writing new sitemap - please adjust if needed' sitemap.write_map() - sitemap.graph() + # Generate a pygraphviz image of the site (TODO: currently not used) + sitemap.graph() + # Start processing the docbook articles to static html sitemap.process(args.style) - t1 = time.time() + # Publish static html and style data (css, images, fonts) to destination dir + t1 = time() sitemap.publish(args.output,args.style) - t2 = time.time() + t2 = time() print "Publish [%5.2f s]" % (round(t2-t1,2)) print "Total [%5.2f s]" % (round(t2-ts,2)) return 0