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.last_stat = info.stat = os.stat(name)
self.setFileInfo(f, info)
# update the syntax highlighting incase we changed the file
# extension
# update the syntax highlighting in case we changed the file extension
syntax = theResources.guessSyntaxForFile(name, ss)
if syntax is not None:
self.setSyntax(syntax)

View File

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