|
1 | 1 | """Script to generate doxygen documentation. |
2 | 2 | """ |
3 | 3 | from __future__ import print_function |
| 4 | +from __future__ import unicode_literals |
4 | 5 | from devtools import tarball |
5 | 6 | from contextlib import contextmanager |
6 | 7 | import subprocess |
@@ -42,12 +43,12 @@ def do_subst_in_file(targetfile, sourcefile, dict): |
42 | 43 | For example, if dict is {'%VERSION%': '1.2345', '%BASE%': 'MyProg'}, |
43 | 44 | then all instances of %VERSION% in the file will be replaced with 1.2345 etc. |
44 | 45 | """ |
45 | | - with open(sourcefile, 'rb') as f: |
| 46 | + with open(sourcefile, 'r') as f: |
46 | 47 | contents = f.read() |
47 | 48 | for (k,v) in list(dict.items()): |
48 | 49 | v = v.replace('\\','\\\\') |
49 | 50 | contents = re.sub(k, v, contents) |
50 | | - with open(targetfile, 'wb') as f: |
| 51 | + with open(targetfile, 'w') as f: |
51 | 52 | f.write(contents) |
52 | 53 |
|
53 | 54 | def getstatusoutput(cmd): |
@@ -100,7 +101,7 @@ def build_doc(options, make_release=False): |
100 | 101 | options.open = False |
101 | 102 | options.silent = True |
102 | 103 |
|
103 | | - version = open('version','rt').read().strip() |
| 104 | + version = open('version', 'rt').read().strip() |
104 | 105 | output_dir = 'dist/doxygen' # relative to doc/doxyfile location. |
105 | 106 | if not os.path.isdir(output_dir): |
106 | 107 | os.makedirs(output_dir) |
@@ -132,7 +133,7 @@ def yesno(bool): |
132 | 133 | do_subst_in_file('doc/doxyfile', 'doc/doxyfile.in', subst_keys) |
133 | 134 | run_doxygen(options.doxygen_path, 'doc/doxyfile', 'doc', is_silent=options.silent) |
134 | 135 | if not options.silent: |
135 | | - print(open(warning_log_path, 'rb').read()) |
| 136 | + print(open(warning_log_path, 'r').read()) |
136 | 137 | index_path = os.path.abspath(os.path.join('doc', subst_keys['%HTML_OUTPUT%'], 'index.html')) |
137 | 138 | print('Generated documentation can be found in:') |
138 | 139 | print(index_path) |
|
0 commit comments