11"""Script to generate doxygen documentation.
22"""
3-
3+ from __future__ import print_function
4+ from devtools import tarball
45import re
56import os
67import os .path
78import sys
89import shutil
9- from devtools import tarball
1010
1111def find_program (* filenames ):
1212 """find a program in folders path_lst, and sets env[var]
@@ -33,17 +33,17 @@ def do_subst_in_file(targetfile, sourcefile, dict):
3333 contents = f .read ()
3434 f .close ()
3535 except :
36- print "Can't read source file %s" % sourcefile
36+ print ( "Can't read source file %s" % sourcefile )
3737 raise
38- for (k ,v ) in dict .items ():
38+ for (k ,v ) in list ( dict .items () ):
3939 v = v .replace ('\\ ' ,'\\ \\ ' )
4040 contents = re .sub (k , v , contents )
4141 try :
4242 f = open (targetfile , 'wb' )
4343 f .write (contents )
4444 f .close ()
4545 except :
46- print "Can't write target file %s" % targetfile
46+ print ( "Can't write target file %s" % targetfile )
4747 raise
4848
4949def run_doxygen (doxygen_path , config_file , working_dir , is_silent ):
@@ -53,12 +53,12 @@ def run_doxygen(doxygen_path, config_file, working_dir, is_silent):
5353 try :
5454 os .chdir ( working_dir )
5555 cmd = [doxygen_path , config_file ]
56- print 'Running:' , ' ' .join ( cmd )
56+ print ( 'Running:' , ' ' .join ( cmd ) )
5757 try :
5858 import subprocess
5959 except :
6060 if os .system ( ' ' .join ( cmd ) ) != 0 :
61- print 'Documentation generation failed'
61+ print ( 'Documentation generation failed' )
6262 return False
6363 else :
6464 if is_silent :
@@ -67,8 +67,8 @@ def run_doxygen(doxygen_path, config_file, working_dir, is_silent):
6767 process = subprocess .Popen ( cmd )
6868 stdout , _ = process .communicate ()
6969 if process .returncode :
70- print 'Documentation generation failed:'
71- print stdout
70+ print ( 'Documentation generation failed:' )
71+ print ( stdout )
7272 return False
7373 return True
7474 finally :
@@ -107,23 +107,23 @@ def yesno( bool ):
107107 }
108108
109109 if os .path .isdir ( output_dir ):
110- print 'Deleting directory:' , output_dir
110+ print ( 'Deleting directory:' , output_dir )
111111 shutil .rmtree ( output_dir )
112112 if not os .path .isdir ( output_dir ):
113113 os .makedirs ( output_dir )
114114
115115 do_subst_in_file ( 'doc/doxyfile' , 'doc/doxyfile.in' , subst_keys )
116116 ok = run_doxygen ( options .doxygen_path , 'doc/doxyfile' , 'doc' , is_silent = options .silent )
117117 if not options .silent :
118- print open (warning_log_path , 'rb' ).read ()
118+ print ( open (warning_log_path , 'rb' ).read () )
119119 index_path = os .path .abspath (os .path .join ('doc' , subst_keys ['%HTML_OUTPUT%' ], 'index.html' ))
120- print 'Generated documentation can be found in:'
121- print index_path
120+ print ( 'Generated documentation can be found in:' )
121+ print ( index_path )
122122 if options .open :
123123 import webbrowser
124124 webbrowser .open ( 'file://' + index_path )
125125 if options .make_tarball :
126- print 'Generating doc tarball to' , tarball_path
126+ print ( 'Generating doc tarball to' , tarball_path )
127127 tarball_sources = [
128128 output_dir ,
129129 'README.txt' ,
0 commit comments