File: python3.patch

package info (click to toggle)
liquidwar 5.6.5-2.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 26,328 kB
  • sloc: ansic: 26,238; xml: 4,011; sh: 3,825; asm: 1,344; makefile: 1,343; python: 537; php: 487; perl: 29; sql: 22; javascript: 11
file content (235 lines) | stat: -rw-r--r-- 7,721 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
Author: Reiner Herrmann <reiner@reiner-h.de>
Description: Port makedoc.py to Python 3

--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -110,31 +110,31 @@
 
 html/%.html: xml/%.xml makedoc.py html/header.inc html/footer.inc
 	@echo Creating $@ from $<
-	@python -c "import makedoc; makedoc.make_html('$@','$<','html/header.inc','html/footer.inc')"
+	@python3 -c "import makedoc; makedoc.make_html('$@','$<','html/header.inc','html/footer.inc')"
 
 php/%.php: xml/%.xml makedoc.py
 	@echo Creating $@ from $<
-	@python -c "import makedoc; makedoc.make_php('$@','$<')"
+	@python3 -c "import makedoc; makedoc.make_php('$@','$<')"
 
 tex/%.tex: xml/%.xml makedoc.py
 	@echo Creating $@ from $<
-	@python -c "import makedoc; makedoc.make_tex('$@','$<')"
+	@python3 -c "import makedoc; makedoc.make_tex('$@','$<')"
 
 man/%.man: xml/%.xml makedoc.py
 	@echo Creating $@ from $<
-	@python -c "import makedoc; makedoc.make_man('$@','$<')"
+	@python3 -c "import makedoc; makedoc.make_man('$@','$<')"
 
 txt/%.txt: xml/%.xml makedoc.py
 	@echo Creating $@ from $<
-	@python -c "import makedoc; makedoc.make_txt('$@','$<','Liquid War (v$(VERSION))')"
+	@python3 -c "import makedoc; makedoc.make_txt('$@','$<','Liquid War (v$(VERSION))')"
 
 texi/%.texi: xml/%.xml makedoc.py
 	@echo Creating $@ from $<
-	@python -c "import makedoc; makedoc.make_texi('$@','$<')"
+	@python3 -c "import makedoc; makedoc.make_texi('$@','$<')"
 
 uwc/%.uwc: xml/%.xml makedoc.py
 	@echo Creating $@ from $<
-	@python -c "import makedoc; makedoc.make_uwc('$@','$<')"
+	@python3 -c "import makedoc; makedoc.make_uwc('$@','$<')"
 
 %.gz: %
 	@if [ -f $< ]; then echo "Compressing $@..."; gzip -c -9 $< > $@; fi
--- a/doc/makedoc.py
+++ b/doc/makedoc.py
@@ -16,14 +16,14 @@
 def remove_duplicate_blanks(text):
     result=text
 
-    result=string.replace(result,"\t"," ")
-    result=string.replace(result,"\n"," ")
+    result=result.replace("\t"," ")
+    result=result.replace("\n"," ")
 
     if (result!=""):
         temp=""
         while temp!=result:
             temp=result
-            result=string.replace(result,"  "," ")
+            result=result.replace("  "," ")
 
     return result
 
@@ -74,11 +74,11 @@
 def format_html(text):
     result=text
 
-    result=string.replace(result,"<","ufoot_html_lt")
-    result=string.replace(result,">","ufoot_html_gt")
-    result=string.replace(result,"&","&amp;")
-    result=string.replace(result,"ufoot_html_lt","&lt;")
-    result=string.replace(result,"ufoot_html_gt","&gt;")    
+    result=result.replace("<","ufoot_html_lt")
+    result=result.replace(">","ufoot_html_gt")
+    result=result.replace("&","&amp;")
+    result=result.replace("ufoot_html_lt","&lt;")
+    result=result.replace("ufoot_html_gt","&gt;")    
 
     # Uncomment this to make mailing list adresses look like "xxx at xxx"
     # instead of "xxx@xxx". This can prevent spammers from harvesting
@@ -97,31 +97,31 @@
 def format_tex(text):
     result=text
 
-    result=string.replace(result,"\\","$\\backslash$")
-    result=string.replace(result,"_","\\_")
-    result=string.replace(result,"#","\\#")
-    result=string.replace(result,"%","\\%")
-    result=string.replace(result,"}","\\}")
-    result=string.replace(result,"<","$<$")
-    result=string.replace(result,">","$>$")
-    result=string.replace(result,"~","$\\tilde{}$")
+    result=result.replace("\\","$\\backslash$")
+    result=result.replace("_","\\_")
+    result=result.replace("#","\\#")
+    result=result.replace("%","\\%")
+    result=result.replace("}","\\}")
+    result=result.replace("<","$<$")
+    result=result.replace(">","$>$")
+    result=result.replace("~","$\\tilde{}$")
     
     return result
 
 def format_texi(text):
     result=text
 
-    result=string.replace(result,"@","@@")
-    result=string.replace(result,"}","@}")
-    result=string.replace(result,"{","@{")
+    result=result.replace("@","@@")
+    result=result.replace("}","@}")
+    result=result.replace("{","@{")
 
     return result
 
 def format_uwc(text):
     result=text
 
-    result=string.replace(result,"]","]")
-    result=string.replace(result,"[","[[")
+    result=result.replace("]","]")
+    result=result.replace("[","[[")
 
     return result
 
@@ -139,8 +139,8 @@
     result=text
 
     result=format_uwc(result)
-    result=string.replace(result,"\n"," ")
-    result=string.replace(result,"\r"," ")
+    result=result.replace("\n"," ")
+    result=result.replace("\r"," ")
     result=remove_duplicate_blanks(result)
 
     return result
@@ -208,7 +208,7 @@
         if tag=="code":
             self.start_code()
     def endElement(self,tag):
-        data=string.strip(self.charbuf)
+        data=self.charbuf.strip()
         if (data!=""):
             self.write(self.translate(data,self.stack[-1]))
         self.charbuf=""
@@ -366,7 +366,7 @@
         self.write("\n\\end{verbatim}\n")
     def translate(self,data,tag):
         result=data
-	result=format_email_and_url(result)
+        result=format_email_and_url(result)
         if (tag!="code"):
             result=format_tex(result)
         return result
@@ -405,12 +405,12 @@
         self.write("\n")
     def translate(self,data,tag):
         result=data
-	result=format_email_and_url(result)
-        result=string.replace(result,"\\","\\\\")
-        result=string.replace(result,".","\.")
-        result=string.replace(result,"-","\-")
+        result=format_email_and_url(result)
+        result=result.replace("\\","\\\\")
+        result=result.replace(".","\.")
+        result=result.replace("-","\-")
         if (tag=="code"):
-            result=string.replace(result,"\n","\n.br\n")
+            result=result.replace("\n","\n.br\n")
         else:
             result=remove_duplicate_blanks(result)
         return result
@@ -460,10 +460,10 @@
         self.write("\n")
     def translate(self,data,tag):
         result=data
-	result=format_email_and_url(result)
+        result=format_email_and_url(result)
         if (tag=="code"):
             result=" "*self.indent+\
-                    string.replace(result,"\n","\n"+" "*self.indent)
+                    result.replace("\n","\n"+" "*self.indent)
         else:
             result=format_text(result,self.indent,80)
             if (tag=="elem"):
@@ -505,7 +505,7 @@
         self.write("\n@end example\n")
     def translate(self,data,tag):
         result=data
-	result=format_email_and_url(result)
+        result=format_email_and_url(result)
 
         if (tag!="code"):
             result=remove_duplicate_blanks(result)
@@ -548,7 +548,7 @@
         self.write("\n")
     def translate(self,data,tag):
         result=data
-	result=format_email_and_url(result)
+        result=format_email_and_url(result)
 
         if (tag=="code"):
             result=format_uwc_code(result)
@@ -560,7 +560,7 @@
         return result
 
 def run_parser(handler,dst,src):
-    dst_file=open(dst,"w")
+    dst_file=open(dst,"wb")
     src_file=open(src,"r")
     #src_code=src_file.read()
     parser=xml.sax.make_parser()
@@ -602,8 +602,8 @@
     run_parser(handler,txt_file,xml_file)
 
 def make_texi(texi_file,xml_file):
-    node=string.replace(xml_file,".xml","")
-    node=string.replace(node,"xml/","")
+    node=xml_file.replace(".xml","")
+    node=node.replace("xml/","")
     parser=xml.sax.make_parser()
     handler=XMLToTexi(node)
     run_parser(handler,texi_file,xml_file)
--- a/configure.ac
+++ b/configure.ac
@@ -123,7 +123,7 @@
 
 
 dnl Various checks which will enable/disable some of the doc targets 
-AC_CHECK_PROG(PYTHON,python,yes,no)
+AC_CHECK_PROG(PYTHON,python3,yes,no)
 AC_CHECK_PROG(GZIP,gzip,yes,no)
 AC_CHECK_PROG(LATEX,latex,yes,no)
 AC_CHECK_PROG(DVIPS,dvips,yes,no)