mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-13 10:22:55 +01:00
make doxybuild.py work with python3.4
This commit is contained in:
parent
bb0c80b3e5
commit
f357688893
@ -1,5 +1,5 @@
|
|||||||
from contextlib import closing
|
from contextlib import closing
|
||||||
import os.path
|
import os
|
||||||
import tarfile
|
import tarfile
|
||||||
|
|
||||||
TARGZ_DEFAULT_COMPRESSION_LEVEL = 9
|
TARGZ_DEFAULT_COMPRESSION_LEVEL = 9
|
||||||
@ -34,7 +34,8 @@ def make_tarball(tarball_path, sources, base_dir, prefix_dir=''):
|
|||||||
for source in sources:
|
for source in sources:
|
||||||
source_path = source
|
source_path = source
|
||||||
if os.path.isdir(source):
|
if os.path.isdir(source):
|
||||||
os.path.walk(source_path, visit, tar)
|
for dirpath, dirnames, filenames in os.walk(source_path):
|
||||||
|
visit(tar, dirpath, filenames)
|
||||||
else:
|
else:
|
||||||
path_in_tar = archive_name(source_path)
|
path_in_tar = archive_name(source_path)
|
||||||
tar.add(source_path, path_in_tar) # filename, arcname
|
tar.add(source_path, path_in_tar) # filename, arcname
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""Script to generate doxygen documentation.
|
"""Script to generate doxygen documentation.
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
from devtools import tarball
|
from devtools import tarball
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -42,12 +43,12 @@ def do_subst_in_file(targetfile, sourcefile, dict):
|
|||||||
For example, if dict is {'%VERSION%': '1.2345', '%BASE%': 'MyProg'},
|
For example, if dict is {'%VERSION%': '1.2345', '%BASE%': 'MyProg'},
|
||||||
then all instances of %VERSION% in the file will be replaced with 1.2345 etc.
|
then all instances of %VERSION% in the file will be replaced with 1.2345 etc.
|
||||||
"""
|
"""
|
||||||
with open(sourcefile, 'rb') as f:
|
with open(sourcefile, 'r') as f:
|
||||||
contents = f.read()
|
contents = f.read()
|
||||||
for (k,v) in list(dict.items()):
|
for (k,v) in list(dict.items()):
|
||||||
v = v.replace('\\','\\\\')
|
v = v.replace('\\','\\\\')
|
||||||
contents = re.sub(k, v, contents)
|
contents = re.sub(k, v, contents)
|
||||||
with open(targetfile, 'wb') as f:
|
with open(targetfile, 'w') as f:
|
||||||
f.write(contents)
|
f.write(contents)
|
||||||
|
|
||||||
def getstatusoutput(cmd):
|
def getstatusoutput(cmd):
|
||||||
@ -100,7 +101,7 @@ def build_doc(options, make_release=False):
|
|||||||
options.open = False
|
options.open = False
|
||||||
options.silent = True
|
options.silent = True
|
||||||
|
|
||||||
version = open('version','rt').read().strip()
|
version = open('version', 'rt').read().strip()
|
||||||
output_dir = 'dist/doxygen' # relative to doc/doxyfile location.
|
output_dir = 'dist/doxygen' # relative to doc/doxyfile location.
|
||||||
if not os.path.isdir(output_dir):
|
if not os.path.isdir(output_dir):
|
||||||
os.makedirs(output_dir)
|
os.makedirs(output_dir)
|
||||||
@ -132,7 +133,7 @@ def build_doc(options, make_release=False):
|
|||||||
do_subst_in_file('doc/doxyfile', 'doc/doxyfile.in', subst_keys)
|
do_subst_in_file('doc/doxyfile', 'doc/doxyfile.in', subst_keys)
|
||||||
run_doxygen(options.doxygen_path, 'doc/doxyfile', 'doc', is_silent=options.silent)
|
run_doxygen(options.doxygen_path, 'doc/doxyfile', 'doc', is_silent=options.silent)
|
||||||
if not options.silent:
|
if not options.silent:
|
||||||
print(open(warning_log_path, 'rb').read())
|
print(open(warning_log_path, 'r').read())
|
||||||
index_path = os.path.abspath(os.path.join('doc', subst_keys['%HTML_OUTPUT%'], 'index.html'))
|
index_path = os.path.abspath(os.path.join('doc', subst_keys['%HTML_OUTPUT%'], 'index.html'))
|
||||||
print('Generated documentation can be found in:')
|
print('Generated documentation can be found in:')
|
||||||
print(index_path)
|
print(index_path)
|
||||||
|
Loading…
Reference in New Issue
Block a user