Skip to content

Commit c02baaf

Browse files
committed
Update doc scripts for Python 3 compatibility
1 parent 36a0457 commit c02baaf

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

Doc/Manual/makechap.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
# then change the heading link name to something that does not look like an
1212
# autogenerated link name.
1313
###############################################################################
14+
from __future__ import print_function
1415

1516
import sys
1617
import re
17-
import string
1818

1919
###############################################################################
2020
# Functions
@@ -58,11 +58,11 @@ def getheadingtext(m, s):
5858
###############################################################################
5959

6060
if len(sys.argv) != 3:
61-
print "usage: makechap.py filename num"
61+
print("usage: makechap.py filename num")
6262
sys.exit(1)
6363

6464
filename = sys.argv[1]
65-
filenamebase = string.split(filename,".")[0]
65+
filenamebase = filename.split(".")[0]
6666
num = int(sys.argv[2])
6767

6868
section = 0
@@ -223,6 +223,6 @@ def getheadingtext(m, s):
223223
# Print the TOC data to stdout correcting the anchor links for external referencing
224224

225225
index = index.replace("<li><a href=\"#","<li><a href=\"%s#" % filename)
226-
print """<h3><a href="%s#%s">%d %s</a></h3>\n""" % (filename,filenamebase,num,name)
227-
print index
226+
print("""<h3><a href="%s#%s">%d %s</a></h3>\n""" % (filename,filenamebase,num,name))
227+
print(index)
228228

Doc/Manual/maketoc.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#!/usr/bin/env python
22

3+
from __future__ import print_function
34
import sys
45
import os
56
chs = open("chapters").readlines()
67

78
f = open("Contents.html","w")
8-
print >>f, """
9+
f.write("""
910
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
1011
<HTML>
1112
<HEAD>
@@ -17,23 +18,25 @@
1718
<H1><a name="Contents"></a>SWIG Users Manual</H1>
1819
1920
<p>
20-
"""
21+
22+
""")
2123

2224
f.close()
2325

2426
num = 1
2527

2628
for c in chs:
2729
c = c.strip()
28-
print "Processing %s" % c
30+
print("Processing " + c)
2931
if c:
3032
os.system("python makechap.py %s %d >> Contents.html" % (c,num))
3133
num += 1
32-
34+
3335
f = open("Contents.html","a")
34-
print >>f, """
36+
f.write("""
3537
</BODY>
3638
</HTML>
37-
"""
39+
40+
""")
3841

3942

0 commit comments

Comments
 (0)