74 |
74 |
75 patchPositionFound = False |
75 patchPositionFound = False |
76 |
76 |
77 for line in lines: |
77 for line in lines: |
78 if patchPositionFound and \ |
78 if patchPositionFound and \ |
79 (line.startswith(\ |
79 (line.startswith( |
80 " # patched by eric5 install script.") or \ |
80 " # patched by eric5 install script.") or \ |
81 line.startswith(\ |
81 line.startswith( |
82 " self.datasize = len(self.data)")): |
82 " self.datasize = len(self.data)")): |
83 return True |
83 return True |
84 if line.startswith(\ |
84 if line.startswith( |
85 " self.data = self.charset_converter(self.data)"): |
85 " self.data = self.charset_converter(self.data)"): |
86 patchPositionFound = True |
86 patchPositionFound = True |
87 continue |
87 continue |
88 |
88 |
89 return False |
89 return False |
112 |
112 |
113 sn = "xmlutils.py" |
113 sn = "xmlutils.py" |
114 s = open(sn, "w", encoding = "utf-8") |
114 s = open(sn, "w", encoding = "utf-8") |
115 for line in lines: |
115 for line in lines: |
116 if patchPositionFound: |
116 if patchPositionFound: |
117 if not line.startswith(\ |
117 if not line.startswith( |
118 " # patched by eric5 install script.") and \ |
118 " # patched by eric5 install script.") and \ |
119 not line.startswith(\ |
119 not line.startswith( |
120 " self.datasize = len(self.data)"): |
120 " self.datasize = len(self.data)"): |
121 s.write(" # patched by eric5 install script.\n") |
121 s.write(" # patched by eric5 install script.\n") |
122 s.write(" self.datasize = len(self.data)\n") |
122 s.write(" self.datasize = len(self.data)\n") |
123 patched = True |
123 patched = True |
124 patchPositionFound = False |
124 patchPositionFound = False |
125 s.write(line) |
125 s.write(line) |
126 if line.startswith(\ |
126 if line.startswith( |
127 " self.data = self.charset_converter(self.data)"): |
127 " self.data = self.charset_converter(self.data)"): |
128 patchPositionFound = True |
128 patchPositionFound = True |
129 continue |
129 continue |
130 s.close() |
130 s.close() |
131 |
131 |