mirror of https://gitlab.com/ita1024/waf.git
iso8859-1 -> latin-1
This commit is contained in:
parent
87bf7ae1fa
commit
f1487eab44
|
@ -19,7 +19,7 @@ def build(bld):
|
|||
features = 'subst', # the feature 'subst' overrides the source/target processing
|
||||
source = 'foo.in', # list of string or nodes
|
||||
target = 'foo.txt', # list of strings or nodes
|
||||
encoding = 'ascii', # file encoding for python3, default is ISO8859-1
|
||||
encoding = 'ascii', # file encoding for python3, default is latin-1
|
||||
install_path = '/tmp/uff/', # installation path, optional
|
||||
chmod = Utils.O755, # installation mode, optional
|
||||
PREFIX = bld.env.PREFIX, # variables to use in the substitution
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# encoding: ISO8859-1
|
||||
# encoding: utf-8
|
||||
# Thomas Nagy, 2010
|
||||
|
||||
top = '.'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# encoding: ISO8859-1
|
||||
# encoding: utf-8
|
||||
# Thomas Nagy, 2010
|
||||
|
||||
from waflib import Logs
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#! /usr/bin/env python
|
||||
# encoding: ISO8859-1
|
||||
# encoding: utf-8
|
||||
# Thomas Nagy, 2014-2015
|
||||
|
||||
"""
|
||||
A simple file for verifying signatures in signed waf files
|
||||
This script is meant for Python >= 2.6 and the encoding is bytes - ISO8859-1
|
||||
This script is meant for Python >= 2.6 and the encoding is bytes - latin-1
|
||||
|
||||
Distributing detached signatures is boring
|
||||
"""
|
||||
|
@ -33,14 +33,14 @@ if __name__ == '__main__':
|
|||
try:
|
||||
txt = f.read()
|
||||
|
||||
lastline = txt.decode('ISO8859-1').splitlines()[-1] # just the last line
|
||||
lastline = txt.decode('latin-1').splitlines()[-1] # just the last line
|
||||
if not lastline.startswith('#-----BEGIN PGP SIGNATURE-----'):
|
||||
print("ERROR: there is no signature to verify in %r :-/" % infile)
|
||||
sys.exit(1)
|
||||
|
||||
sigtext = lastline.replace('\\n', '\n') # convert newlines
|
||||
sigtext = sigtext[1:] # omit the '# character'
|
||||
sigtext = sigtext.encode('ISO8859-1') # python3
|
||||
sigtext = sigtext.encode('latin-1') # python3
|
||||
|
||||
f2.write(sigtext)
|
||||
f1.write(txt[:-len(lastline) - 1]) # one newline character was eaten from splitlines()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# encoding: ISO8859-1
|
||||
# encoding: latin-1
|
||||
# Thomas Nagy, 2005-2016
|
||||
#
|
||||
"""
|
||||
|
|
|
@ -355,14 +355,14 @@ class Context(ctx):
|
|||
|
||||
if out:
|
||||
if not isinstance(out, str):
|
||||
out = out.decode(sys.stdout.encoding or 'iso8859-1', errors='replace')
|
||||
out = out.decode(sys.stdout.encoding or 'latin-1', errors='replace')
|
||||
if self.logger:
|
||||
self.logger.debug('out: %s', out)
|
||||
else:
|
||||
Logs.info(out, extra={'stream':sys.stdout, 'c1': ''})
|
||||
if err:
|
||||
if not isinstance(err, str):
|
||||
err = err.decode(sys.stdout.encoding or 'iso8859-1', errors='replace')
|
||||
err = err.decode(sys.stdout.encoding or 'latin-1', errors='replace')
|
||||
if self.logger:
|
||||
self.logger.error('err: %s' % err)
|
||||
else:
|
||||
|
@ -440,9 +440,9 @@ class Context(ctx):
|
|||
raise Errors.WafError('Execution failure: %s' % str(e), ex=e)
|
||||
|
||||
if not isinstance(out, str):
|
||||
out = out.decode(sys.stdout.encoding or 'iso8859-1', errors='replace')
|
||||
out = out.decode(sys.stdout.encoding or 'latin-1', errors='replace')
|
||||
if not isinstance(err, str):
|
||||
err = err.decode(sys.stdout.encoding or 'iso8859-1', errors='replace')
|
||||
err = err.decode(sys.stdout.encoding or 'latin-1', errors='replace')
|
||||
|
||||
if out and quiet != STDOUT and quiet != BOTH:
|
||||
self.to_log('out: %s' % out)
|
||||
|
|
|
@ -121,7 +121,7 @@ class Node(object):
|
|||
"""
|
||||
raise Errors.WafError('nodes are not supposed to be copied')
|
||||
|
||||
def read(self, flags='r', encoding='ISO8859-1'):
|
||||
def read(self, flags='r', encoding='latin-1'):
|
||||
"""
|
||||
Reads and returns the contents of the file represented by this node, see :py:func:`waflib.Utils.readf`::
|
||||
|
||||
|
@ -137,7 +137,7 @@ class Node(object):
|
|||
"""
|
||||
return Utils.readf(self.abspath(), flags, encoding)
|
||||
|
||||
def write(self, data, flags='w', encoding='ISO8859-1'):
|
||||
def write(self, data, flags='w', encoding='latin-1'):
|
||||
"""
|
||||
Writes data to the file represented by this node, see :py:func:`waflib.Utils.writef`::
|
||||
|
||||
|
|
|
@ -863,10 +863,10 @@ if sys.hexversion > 0x3000000:
|
|||
try:
|
||||
return self.uid_
|
||||
except AttributeError:
|
||||
m = Utils.md5(self.__class__.__name__.encode('iso8859-1', 'xmlcharrefreplace'))
|
||||
m = Utils.md5(self.__class__.__name__.encode('latin-1', 'xmlcharrefreplace'))
|
||||
up = m.update
|
||||
for x in self.inputs + self.outputs:
|
||||
up(x.abspath().encode('iso8859-1', 'xmlcharrefreplace'))
|
||||
up(x.abspath().encode('latin-1', 'xmlcharrefreplace'))
|
||||
self.uid_ = m.digest()
|
||||
return self.uid_
|
||||
uid.__doc__ = Task.uid.__doc__
|
||||
|
|
|
@ -723,11 +723,11 @@ class subst_pc(Task.Task):
|
|||
self.force_permissions()
|
||||
return ret
|
||||
|
||||
code = self.inputs[0].read(encoding=getattr(self.generator, 'encoding', 'ISO8859-1'))
|
||||
code = self.inputs[0].read(encoding=getattr(self.generator, 'encoding', 'latin-1'))
|
||||
if getattr(self.generator, 'subst_fun', None):
|
||||
code = self.generator.subst_fun(self, code)
|
||||
if code is not None:
|
||||
self.outputs[0].write(code, encoding=getattr(self.generator, 'encoding', 'ISO8859-1'))
|
||||
self.outputs[0].write(code, encoding=getattr(self.generator, 'encoding', 'latin-1'))
|
||||
self.force_permissions()
|
||||
return None
|
||||
|
||||
|
@ -758,7 +758,7 @@ class subst_pc(Task.Task):
|
|||
d[x] = tmp
|
||||
|
||||
code = code % d
|
||||
self.outputs[0].write(code, encoding=getattr(self.generator, 'encoding', 'ISO8859-1'))
|
||||
self.outputs[0].write(code, encoding=getattr(self.generator, 'encoding', 'latin-1'))
|
||||
self.generator.bld.raw_deps[self.uid()] = lst
|
||||
|
||||
# make sure the signature is updated
|
||||
|
|
|
@ -199,7 +199,7 @@ class grep_for_endianness(Task.Task):
|
|||
"""
|
||||
color = 'PINK'
|
||||
def run(self):
|
||||
txt = self.inputs[0].read(flags='rb').decode('iso8859-1')
|
||||
txt = self.inputs[0].read(flags='rb').decode('latin-1')
|
||||
if txt.find('LiTTleEnDian') > -1:
|
||||
self.generator.tmp.append('little')
|
||||
elif txt.find('BIGenDianSyS') > -1:
|
||||
|
|
|
@ -188,7 +188,7 @@ is_win32 = os.sep == '\\' or sys.platform == 'win32' # msys2
|
|||
Whether this system is a Windows series
|
||||
"""
|
||||
|
||||
def readf(fname, m='r', encoding='ISO8859-1'):
|
||||
def readf(fname, m='r', encoding='latin-1'):
|
||||
"""
|
||||
Reads an entire file into a string. See also :py:meth:`waflib.Node.Node.readf`::
|
||||
|
||||
|
@ -226,7 +226,7 @@ def readf(fname, m='r', encoding='ISO8859-1'):
|
|||
f.close()
|
||||
return txt
|
||||
|
||||
def writef(fname, data, m='w', encoding='ISO8859-1'):
|
||||
def writef(fname, data, m='w', encoding='latin-1'):
|
||||
"""
|
||||
Writes an entire file from a string.
|
||||
See also :py:meth:`waflib.Node.Node.writef`::
|
||||
|
@ -274,7 +274,7 @@ def h_file(fname):
|
|||
f.close()
|
||||
return m.digest()
|
||||
|
||||
def readf_win32(f, m='r', encoding='ISO8859-1'):
|
||||
def readf_win32(f, m='r', encoding='latin-1'):
|
||||
flags = os.O_NOINHERIT | os.O_RDONLY
|
||||
if 'b' in m:
|
||||
flags |= os.O_BINARY
|
||||
|
@ -304,7 +304,7 @@ def readf_win32(f, m='r', encoding='ISO8859-1'):
|
|||
f.close()
|
||||
return txt
|
||||
|
||||
def writef_win32(f, data, m='w', encoding='ISO8859-1'):
|
||||
def writef_win32(f, data, m='w', encoding='latin-1'):
|
||||
if sys.hexversion > 0x3000000 and not 'b' in m:
|
||||
data = data.encode(encoding)
|
||||
m += 'b'
|
||||
|
@ -473,7 +473,7 @@ def split_path_msys(path):
|
|||
global msysroot
|
||||
if not msysroot:
|
||||
# msys has python 2.7 or 3, so we can use this
|
||||
msysroot = subprocess.check_output(['cygpath', '-w', '/']).decode(sys.stdout.encoding or 'iso8859-1')
|
||||
msysroot = subprocess.check_output(['cygpath', '-w', '/']).decode(sys.stdout.encoding or 'latin-1')
|
||||
msysroot = msysroot.strip()
|
||||
path = os.path.normpath(msysroot + os.sep + path)
|
||||
return split_path_win32(path)
|
||||
|
@ -630,7 +630,7 @@ def h_cmd(ins):
|
|||
# or just a python function
|
||||
ret = str(h_fun(ins))
|
||||
if sys.hexversion > 0x3000000:
|
||||
ret = ret.encode('iso8859-1', 'xmlcharrefreplace')
|
||||
ret = ret.encode('latin-1', 'xmlcharrefreplace')
|
||||
return ret
|
||||
|
||||
reg_subst = re.compile(r"(\\\\)|(\$\$)|\$\{([^}]+)\}")
|
||||
|
|
|
@ -32,7 +32,7 @@ def get_emscripten_version(conf, cc):
|
|||
conf.fatal('Could not determine emscripten version %r: %s' % (cmd, e))
|
||||
|
||||
if not isinstance(out, str):
|
||||
out = out.decode(sys.stdout.encoding or 'iso8859-1')
|
||||
out = out.decode(sys.stdout.encoding or 'latin-1')
|
||||
|
||||
k = {}
|
||||
out = out.splitlines()
|
||||
|
|
|
@ -302,7 +302,7 @@ def rm_blank_lines(txt):
|
|||
|
||||
BOM = '\xef\xbb\xbf'
|
||||
try:
|
||||
BOM = bytes(BOM, 'iso8859-1') # python 3
|
||||
BOM = bytes(BOM, 'latin-1') # python 3
|
||||
except (TypeError, NameError):
|
||||
pass
|
||||
|
||||
|
|
|
@ -359,7 +359,7 @@ def rm_blank_lines(txt):
|
|||
|
||||
BOM = '\xef\xbb\xbf'
|
||||
try:
|
||||
BOM = bytes(BOM, 'iso8859-1') # python 3
|
||||
BOM = bytes(BOM, 'latin-1') # python 3
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ all_sigs_in_cache = (0.0, [])
|
|||
|
||||
def put_data(conn, data):
|
||||
if sys.hexversion > 0x3000000:
|
||||
data = data.encode('iso8859-1')
|
||||
data = data.encode('latin-1')
|
||||
cnt = 0
|
||||
while cnt < len(data):
|
||||
sent = conn.send(data[cnt:])
|
||||
|
@ -107,8 +107,8 @@ def read_header(conn):
|
|||
buf.append(data)
|
||||
cnt += len(data)
|
||||
if sys.hexversion > 0x3000000:
|
||||
ret = ''.encode('iso8859-1').join(buf)
|
||||
ret = ret.decode('iso8859-1')
|
||||
ret = ''.encode('latin-1').join(buf)
|
||||
ret = ret.decode('latin-1')
|
||||
else:
|
||||
ret = ''.join(buf)
|
||||
return ret
|
||||
|
@ -140,8 +140,8 @@ def check_cache(conn, ssig):
|
|||
cnt += len(data)
|
||||
|
||||
if sys.hexversion > 0x3000000:
|
||||
ret = ''.encode('iso8859-1').join(buf)
|
||||
ret = ret.decode('iso8859-1')
|
||||
ret = ''.encode('latin-1').join(buf)
|
||||
ret = ret.decode('latin-1')
|
||||
else:
|
||||
ret = ''.join(buf)
|
||||
|
||||
|
|
|
@ -62,14 +62,14 @@ def exec_command(self, cmd, **kw):
|
|||
|
||||
if out:
|
||||
if not isinstance(out, str):
|
||||
out = out.decode(sys.stdout.encoding or 'iso8859-1')
|
||||
out = out.decode(sys.stdout.encoding or 'latin-1')
|
||||
if self.logger:
|
||||
self.logger.debug('out: %s' % out)
|
||||
else:
|
||||
Logs.info(out, extra={'stream':sys.stdout, 'c1': ''})
|
||||
if err:
|
||||
if not isinstance(err, str):
|
||||
err = err.decode(sys.stdout.encoding or 'iso8859-1')
|
||||
err = err.decode(sys.stdout.encoding or 'latin-1')
|
||||
if self.logger:
|
||||
self.logger.error('err: %s' % err)
|
||||
else:
|
||||
|
|
|
@ -56,7 +56,7 @@ def subst(*k):
|
|||
def r1(code):
|
||||
"utf-8 fixes for python < 2.6"
|
||||
code = code.replace('as e:', ',e:')
|
||||
code = code.replace(".decode(sys.stdout.encoding or'iso8859-1',errors='replace')", '')
|
||||
code = code.replace(".decode(sys.stdout.encoding or'latin-1',errors='replace')", '')
|
||||
return code.replace('.encode()', '')
|
||||
|
||||
@subst('Runner.py')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# encoding: ISO8859-1
|
||||
# encoding: latin-1
|
||||
# Thomas Nagy, 2005-2011
|
||||
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue