View | Details | Raw Unified | Return to bug 234687 | Differences between
and this patch

Collapse All | Expand All

(-)graphics/opensubdiv/files/patch-documentation_processHtml.py (+83 lines)
Line 0 Link Here
1
--- documentation/processHtml.py.orig	2018-07-18 02:17:49 UTC
2
+++ documentation/processHtml.py
3
@@ -25,9 +25,11 @@
4
 
5
 import os
6
 import sys
7
-import string
8
 import re
9
-import HTMLParser
10
+try:
11
+    import HTMLParser
12
+except:
13
+    import html.parser as HTMLParser
14
 
15
 class HtmlToTextParser(HTMLParser.HTMLParser):
16
     def __init__(self):
17
@@ -89,10 +91,10 @@ def ReadNavigationTemplate( filePath ):
18
     try:
19
         navFile = open( filePath, "r")
20
     except IOError:
21
-        print "Could not open file \'"+filePath+"\'"
22
+        print("Could not open file \'"+filePath+"\'")
23
     
24
     with navFile:
25
-        print "Navigation template: \'"+filePath+"\'"
26
+        print("Navigation template: \'"+filePath+"\'")
27
         navHtml = navFile.read()
28
         navHtml = StripHTMLComments(navHtml)
29
         navFile.close()
30
@@ -109,7 +111,7 @@ def WriteIndexFile( outputFile, content ):
31
     except:
32
         pass
33
 
34
-    print "Creating Search-Index File : \""+outputFile+"\""
35
+    print("Creating Search-Index File : \""+outputFile+"\"")
36
 
37
     f = open(outputFile, "w")
38
     f.write(content)
39
@@ -117,7 +119,7 @@ def WriteIndexFile( outputFile, content ):
40
 
41
 #-------------------------------------------------------------------------------
42
 def Usage():
43
-    print str(sys.argv[0])+" <input directory> <output directory> <html template>"
44
+    print(str(sys.argv[0])+" <input directory> <output directory> <html template>")
45
     exit(1);
46
 
47
 
48
@@ -132,7 +134,7 @@ navTemplate = str(sys.argv[2])
49
     
50
 navHtml = ReadNavigationTemplate( navTemplate )
51
 
52
-print "Scanning : \'"+rootDir+"\'"
53
+print("Scanning : \'"+rootDir+"\'")
54
 
55
 searchIndex = 'var tipuesearch = { "pages": [ '
56
 
57
@@ -172,22 +174,22 @@ for root, dirs, files in os.walk(rootDir):
58
 
59
             # if necessary, insert navigation html
60
             if (not parser.HasNavigationSection()):
61
-                loc = string.find(html,"<body>")
62
+                loc = html.find("<body>")
63
                 html = html[:loc+6] + navHtml + html[loc+6:]
64
 
65
                 msg += "added navigation"
66
 
67
             # replace the article title placeholder with the real title
68
             if title:
69
-                html = string.replace(html,"OSD_ARTICLE_TITLE", title)
70
+                html = html.replace("OSD_ARTICLE_TITLE", title)
71
             else:
72
-                html = string.replace(html,"OSD_ARTICLE_TITLE", "")
73
+                html = html.replace("OSD_ARTICLE_TITLE", "")
74
 
75
             f.seek(0)
76
             f.write(html)
77
             f.close()
78
 
79
-            print msg
80
+            print(msg)
81
 
82
 searchIndex = searchIndex + "]};"
83
 
(-)graphics/opensubdiv/files/patch-documentation_processTutorials.py (+29 lines)
Line 0 Link Here
1
--- documentation/processTutorials.py.orig	2019-01-13 21:35:49 UTC
2
+++ documentation/processTutorials.py
3
@@ -33,7 +33,7 @@ def ReadFile(inputfile):
4
     try:
5
         f = open( inputfile, "r")
6
     except IOError:
7
-        print "Could not read file \'"+inputfile+"\'"
8
+        print("Could not read file \'"+inputfile+"\'")
9
     content = f.read()
10
     f.close()
11
     return content
12
@@ -48,7 +48,7 @@ def WriteToFile(outputfile, content):
13
     try:
14
         f = open(outputfile, "w")
15
     except IOError:
16
-        print "Could not write file \'"+outputfile+"\'"
17
+        print("Could not write file \'"+outputfile+"\'")
18
     f.write(content)
19
     f.close()
20
 
21
@@ -85,7 +85,7 @@ def Process(srcfile, title):
22
 
23
 #-------------------------------------------------------------------------------
24
 def Usage():
25
-    print str(sys.argv[0])+" <input file> <output file> <title>"
26
+    print(str(sys.argv[0])+" <input file> <output file> <title>")
27
     exit(1);
28
 
29
 

Return to bug 234687