Skip to content

Commit f357688

Browse files
committed
make doxybuild.py work with python3.4
1 parent bb0c80b commit f357688

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

devtools/tarball.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from contextlib import closing
2-
import os.path
2+
import os
33
import tarfile
44

55
TARGZ_DEFAULT_COMPRESSION_LEVEL = 9
@@ -34,7 +34,8 @@ def visit(tar, dirname, names):
3434
for source in sources:
3535
source_path = source
3636
if os.path.isdir(source):
37-
os.path.walk(source_path, visit, tar)
37+
for dirpath, dirnames, filenames in os.walk(source_path):
38+
visit(tar, dirpath, filenames)
3839
else:
3940
path_in_tar = archive_name(source_path)
4041
tar.add(source_path, path_in_tar) # filename, arcname

doxybuild.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Script to generate doxygen documentation.
22
"""
33
from __future__ import print_function
4+
from __future__ import unicode_literals
45
from devtools import tarball
56
from contextlib import contextmanager
67
import subprocess
@@ -42,12 +43,12 @@ def do_subst_in_file(targetfile, sourcefile, dict):
4243
For example, if dict is {'%VERSION%': '1.2345', '%BASE%': 'MyProg'},
4344
then all instances of %VERSION% in the file will be replaced with 1.2345 etc.
4445
"""
45-
with open(sourcefile, 'rb') as f:
46+
with open(sourcefile, 'r') as f:
4647
contents = f.read()
4748
for (k,v) in list(dict.items()):
4849
v = v.replace('\\','\\\\')
4950
contents = re.sub(k, v, contents)
50-
with open(targetfile, 'wb') as f:
51+
with open(targetfile, 'w') as f:
5152
f.write(contents)
5253

5354
def getstatusoutput(cmd):
@@ -100,7 +101,7 @@ def build_doc(options, make_release=False):
100101
options.open = False
101102
options.silent = True
102103

103-
version = open('version','rt').read().strip()
104+
version = open('version', 'rt').read().strip()
104105
output_dir = 'dist/doxygen' # relative to doc/doxyfile location.
105106
if not os.path.isdir(output_dir):
106107
os.makedirs(output_dir)
@@ -132,7 +133,7 @@ def yesno(bool):
132133
do_subst_in_file('doc/doxyfile', 'doc/doxyfile.in', subst_keys)
133134
run_doxygen(options.doxygen_path, 'doc/doxyfile', 'doc', is_silent=options.silent)
134135
if not options.silent:
135-
print(open(warning_log_path, 'rb').read())
136+
print(open(warning_log_path, 'r').read())
136137
index_path = os.path.abspath(os.path.join('doc', subst_keys['%HTML_OUTPUT%'], 'index.html'))
137138
print('Generated documentation can be found in:')
138139
print(index_path)

0 commit comments

Comments
 (0)