Changed time.time() to time() by importing from time import time
instead. Added some comments, can be improved.
#!/usr/bin/python
import os
#!/usr/bin/python
import os
import argparse
from treecutter.directory import Directory
from treecutter.sitemap import Sitemap
def main():
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/')
parser = argparse.ArgumentParser(description='Process docbook article tree.')
parser.add_argument('--style', nargs='?',
default=os.path.dirname(os.getcwd())+'/style/default/')
default=os.path.dirname(os.getcwd())+'/htdocs/')
args = parser.parse_args()
default=os.path.dirname(os.getcwd())+'/htdocs/')
args = parser.parse_args()
dir_ = Directory()
sitemap = Sitemap()
dir_ = Directory()
sitemap = Sitemap()
+ # Scanning current directory and subdirectory for docbook articles
+ # Reading the sitemap.txt building a Trie structure
+ # Comparing the current state of the dir with the sitemap
missing = dir_.set() - sitemap.set()
removed = sitemap.set() - dir_.set()
for page in removed:
missing = dir_.set() - sitemap.set()
removed = sitemap.set() - dir_.set()
for page in removed:
if len(missing)+len(removed) != 0:
print 'writing new sitemap - please adjust if needed'
sitemap.write_map()
if len(missing)+len(removed) != 0:
print 'writing new sitemap - please adjust if needed'
sitemap.write_map()
+ # 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)
sitemap.process(args.style)
+ # Publish static html and style data (css, images, fonts) to destination dir
+ t1 = time()
sitemap.publish(args.output,args.style)
sitemap.publish(args.output,args.style)
print "Publish [%5.2f s]" % (round(t2-t1,2))
print "Total [%5.2f s]" % (round(t2-ts,2))
return 0
print "Publish [%5.2f s]" % (round(t2-t1,2))
print "Total [%5.2f s]" % (round(t2-ts,2))
return 0