Commits

Anonymous committed 62c045a

Interrupt build process when errors are detected in lore2sphinx and exit.

Comments (0)

Files changed (1)

 A python script that will handle the conversion of 
 twisted lore sources to Sphinx docs.
 '''
+
 import os
+import sys
 import shutil
 
+from subprocess import call
 from ConfigParser import ConfigParser
 
+
 conf_file = 'lore2sphinx.conf'
 
 cp = ConfigParser()
 loredir = cp.get('twisted', 'lore_dir')
 outdir = cp.get('twisted', 'output_dir')
 
-#clean from previous run
+# clean from previous run
 if os.path.exists(outdir):
     shutil.rmtree(outdir)
     
 # copy nondocs
 src = loredir
 dest = outdir
-ignored=shutil.ignore_patterns('*.svn', '*.pyc', '*.xhtml', 'tmp*')
+ignored = shutil.ignore_patterns('*.svn', '*.pyc', '*.xhtml', 'tmp*')
 shutil.copytree(src, dest, ignore=ignored)
     
 # convert_docs
-os.system('python bin/lore2sphinx')
+try:
+    retcode = call("python" + " bin/lore2sphinx", shell=True)       
+except OSError, e:
+    print >>sys.stderr, "Execution failed:", e
+
+if retcode == 1:
+    sys.exit(retcode)
 
 # build_html
 os.chdir('./profiles/twisted')
-os.system('make html')
+os.system('make html')