Skip to content

Commit 2e58c8b

Browse files
committed
print_function and pep8
1 parent 1133e56 commit 2e58c8b

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

doc/scripts/docgen.py

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
1+
from __future__ import print_function
22
import sys
33
import os
44
import shutil
5-
import inspect
65

76
import getopt
87
from collections import defaultdict
@@ -12,13 +11,14 @@
1211
throot = "/".join(sys.path[0].split("/")[:-2])
1312

1413
options = defaultdict(bool)
15-
options.update(dict([x, y or True] for x, y in getopt.getopt(sys.argv[1:], 'o:', ['rst', 'help', 'nopdf'])[0]))
14+
output_arg = getopt.getopt(sys.argv[1:], 'o:', ['rst', 'help', 'nopdf'])[0]
15+
options.update(dict([x, y or True] for x, y in output_arg))
1616
if options['--help']:
17-
print 'Usage: %s [OPTIONS]' % sys.argv[0]
18-
print ' -o <dir>: output the html files in the specified dir'
19-
print ' --rst: only compile the doc (requires sphinx)'
20-
print ' --nopdf: do not produce a PDF file from the doc, only HTML'
21-
print ' --help: this help'
17+
print('Usage: %s [OPTIONS]' % sys.argv[0])
18+
print(' -o <dir>: output the html files in the specified dir')
19+
print(' --rst: only compile the doc (requires sphinx)')
20+
print(' --nopdf: do not produce a PDF file from the doc, only HTML')
21+
print(' --help: this help')
2222
sys.exit(0)
2323

2424
options['--all'] = not bool(options['--rst'])
@@ -49,18 +49,15 @@ def mkdir(path):
4949
import tempfile
5050
workdir = tempfile.mkdtemp()
5151
sphinx.main(['', '-E', '-b', 'latex',
52-
os.path.join(throot, 'doc'), workdir])
52+
os.path.join(throot, 'doc'), workdir])
5353
# Compile to PDF
5454
os.chdir(workdir)
5555
os.system('make')
5656
try:
5757
shutil.copy(os.path.join(workdir, 'deeplearning.pdf'), outdir)
5858
os.chdir(outdir)
5959
shutil.rmtree(workdir)
60-
except OSError, e:
61-
print 'OSError:', e
62-
except IOError, e:
63-
print 'IOError:', e
64-
65-
66-
60+
except OSError as e:
61+
print('OSError:', e)
62+
except IOError as e:
63+
print('IOError:', e)

0 commit comments

Comments
 (0)