mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-15 23:20:05 +02:00
- added (incomplete) script makerelease.py to handle svn tagging and tar balls generation
This commit is contained in:
86
doxybuild.py
86
doxybuild.py
@@ -89,14 +89,14 @@ def do_subst_in_file(targetfile, sourcefile, dict):
|
||||
print "Can't write target file %s"%targetfile
|
||||
raise
|
||||
|
||||
def run_doxygen(doxygen_path, config_file, working_dir):
|
||||
def run_doxygen(doxygen_path, config_file, working_dir, is_silent):
|
||||
config_file = os.path.abspath( config_file )
|
||||
doxygen_path = doxygen_path
|
||||
old_cwd = os.getcwd()
|
||||
try:
|
||||
os.chdir( working_dir )
|
||||
cmd = [doxygen_path, config_file]
|
||||
print ' '.join( cmd )
|
||||
print 'Running:', ' '.join( cmd )
|
||||
try:
|
||||
import subprocess
|
||||
except:
|
||||
@@ -104,40 +104,27 @@ def run_doxygen(doxygen_path, config_file, working_dir):
|
||||
print 'Documentation generation failed'
|
||||
return False
|
||||
else:
|
||||
try:
|
||||
subprocess.check_call( cmd )
|
||||
except subprocess.CalledProcessError:
|
||||
if is_silent:
|
||||
process = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
|
||||
else:
|
||||
process = subprocess.Popen( cmd )
|
||||
stdout, _ = process.communicate()
|
||||
if process.returncode:
|
||||
print 'Documentation generation failed:'
|
||||
print stdout
|
||||
return False
|
||||
return True
|
||||
finally:
|
||||
os.chdir( old_cwd )
|
||||
|
||||
def main():
|
||||
usage = """%prog
|
||||
Generates doxygen documentation in build/doxygen.
|
||||
Optionaly makes a tarball of the documentation to dist/.
|
||||
|
||||
Must be started in the project top directory.
|
||||
"""
|
||||
from optparse import OptionParser
|
||||
parser = OptionParser(usage=usage)
|
||||
parser.allow_interspersed_args = False
|
||||
parser.add_option('--with-dot', dest="with_dot", action='store_true', default=False,
|
||||
help="""Enable usage of DOT to generate collaboration diagram""")
|
||||
parser.add_option('--dot', dest="dot_path", action='store', default=find_program('dot'),
|
||||
help="""Path to GraphViz dot tool. Must be full qualified path. [Default: %default]""")
|
||||
parser.add_option('--doxygen', dest="doxygen_path", action='store', default=find_program('doxygen'),
|
||||
help="""Path to Doxygen tool. [Default: %default]""")
|
||||
parser.add_option('--with-html-help', dest="with_html_help", action='store_true', default=False,
|
||||
help="""Enable generation of Microsoft HTML HELP""")
|
||||
parser.add_option('--no-uml-look', dest="with_uml_look", action='store_false', default=True,
|
||||
help="""Generates DOT graph without UML look [Default: False]""")
|
||||
parser.add_option('--open', dest="open", action='store_true', default=False,
|
||||
help="""Open the HTML index in the web browser after generation""")
|
||||
parser.add_option('--tarball', dest="make_tarball", action='store_true', default=False,
|
||||
help="""Generates a tarball of the documentation in dist/ directory""")
|
||||
parser.enable_interspersed_args()
|
||||
options, args = parser.parse_args()
|
||||
def build_doc( options, make_release=False ):
|
||||
if make_release:
|
||||
options.make_tarball = True
|
||||
options.with_dot = True
|
||||
options.with_html_help = True
|
||||
options.with_uml_look = True
|
||||
options.open = False
|
||||
options.silent = True
|
||||
|
||||
version = open('version','rt').read().strip()
|
||||
output_dir = '../build/doxygen' # relative to doc/doxyfile location.
|
||||
@@ -167,10 +154,9 @@ def main():
|
||||
os.makedirs( full_output_dir )
|
||||
|
||||
do_subst_in_file( 'doc/doxyfile', 'doc/doxyfile.in', subst_keys )
|
||||
ok = run_doxygen( options.doxygen_path, 'doc/doxyfile', 'doc' )
|
||||
print open(os.path.join('doc', warning_log_path), 'rb').read()
|
||||
if not ok:
|
||||
print 'Doxygen generation failed'
|
||||
ok = run_doxygen( options.doxygen_path, 'doc/doxyfile', 'doc', is_silent=options.silent )
|
||||
if not options.silent:
|
||||
print open(os.path.join('doc', warning_log_path), 'rb').read()
|
||||
index_path = os.path.abspath(os.path.join(subst_keys['%HTML_OUTPUT%'], 'index.html'))
|
||||
print 'Generated documentation can be found in:'
|
||||
print index_path
|
||||
@@ -187,5 +173,35 @@ def main():
|
||||
tarball_basedir = os.path.join( full_output_dir, html_output_dirname )
|
||||
make_tarball( tarball_path, tarball_sources, tarball_basedir, html_output_dirname )
|
||||
|
||||
def main():
|
||||
usage = """%prog
|
||||
Generates doxygen documentation in build/doxygen.
|
||||
Optionaly makes a tarball of the documentation to dist/.
|
||||
|
||||
Must be started in the project top directory.
|
||||
"""
|
||||
from optparse import OptionParser
|
||||
parser = OptionParser(usage=usage)
|
||||
parser.allow_interspersed_args = False
|
||||
parser.add_option('--with-dot', dest="with_dot", action='store_true', default=False,
|
||||
help="""Enable usage of DOT to generate collaboration diagram""")
|
||||
parser.add_option('--dot', dest="dot_path", action='store', default=find_program('dot'),
|
||||
help="""Path to GraphViz dot tool. Must be full qualified path. [Default: %default]""")
|
||||
parser.add_option('--doxygen', dest="doxygen_path", action='store', default=find_program('doxygen'),
|
||||
help="""Path to Doxygen tool. [Default: %default]""")
|
||||
parser.add_option('--with-html-help', dest="with_html_help", action='store_true', default=False,
|
||||
help="""Enable generation of Microsoft HTML HELP""")
|
||||
parser.add_option('--no-uml-look', dest="with_uml_look", action='store_false', default=True,
|
||||
help="""Generates DOT graph without UML look [Default: False]""")
|
||||
parser.add_option('--open', dest="open", action='store_true', default=False,
|
||||
help="""Open the HTML index in the web browser after generation""")
|
||||
parser.add_option('--tarball', dest="make_tarball", action='store_true', default=False,
|
||||
help="""Generates a tarball of the documentation in dist/ directory""")
|
||||
parser.add_option('-s', '--silent', dest="silent", action='store_true', default=False,
|
||||
help="""Hides doxygen output""")
|
||||
parser.enable_interspersed_args()
|
||||
options, args = parser.parse_args()
|
||||
build_doc( options )
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Reference in New Issue
Block a user