Fix some typos and convert windows-installer scripts to Python 3

The scripts are poorly converted as Windows is not really supoported
anymore and would need some love from a contributor who actually uses
Windows
This commit is contained in:
Romain Failliot 2021-11-22 18:52:26 -05:00
parent ef9e1b041f
commit f4a446caa8
3 changed files with 12 additions and 13 deletions

View File

@ -534,8 +534,7 @@ class Diffuse(Gtk.Window):
info.name, info.encoding, info.revision, info.label = name, encoding, None, label info.name, info.encoding, info.revision, info.label = name, encoding, None, label
info.last_stat = info.stat = os.stat(name) info.last_stat = info.stat = os.stat(name)
self.setFileInfo(f, info) self.setFileInfo(f, info)
# update the syntax highlighting incase we changed the file # update the syntax highlighting in case we changed the file extension
# extension
syntax = theResources.guessSyntaxForFile(name, ss) syntax = theResources.guessSyntaxForFile(name, ss)
if syntax is not None: if syntax is not None:
self.setSyntax(syntax) self.setSyntax(syntax)

View File

@ -46,7 +46,7 @@ def copyFile(src, dest, use_text_mode=False,enc=None):
s = f.read() s = f.read()
f.close() f.close()
if enc is not None: if enc is not None:
s = codecs.encode(unicode(s, 'utf_8'), enc) s = codecs.encode(str(s, encoding='utf_8'), enc)
f = open(dest, w) f = open(dest, w)
f.write(s) f.write(s)
f.close() f.close()
@ -190,12 +190,12 @@ for lang in os.listdir(d):
while True: while True:
i = s.find('&#', idx) i = s.find('&#', idx)
if i < 0: if i < 0:
a.append(unicode(s[idx:], 'latin_1')) a.append(str(s[idx:], encoding='latin_1'))
break break
a.append(unicode(s[idx:i], 'latin_1')) a.append(str(s[idx:i], encoding='latin_1'))
i += 2 i += 2
j = s.find(';', i) j = s.find(';', i)
a.append(unichr(int(s[i:j]))) a.append(chr(int(s[i:j])))
idx = j + 1 idx = j + 1
s = ''.join(a) s = ''.join(a)
s = codecs.encode(s, 'utf-8') s = codecs.encode(s, 'utf-8')

View File

@ -196,7 +196,7 @@ def copyFile(src, dest, use_text_mode=False,enc=None):
s = f.read() s = f.read()
f.close() f.close()
if enc is not None: if enc is not None:
s = codecs.encode(unicode(s, 'utf_8'), enc) s = codecs.encode(str(s, encoding='utf_8'), enc)
f = open(dest, w) f = open(dest, w)
f.write(s) f.write(s)
f.close() f.close()