mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-15 00:00:03 +08:00
waf: Refector the builder to work with Python3 and UTF-8 source files.
Python 3 requires better UTF-8 handling of files and FreeBSD has UTF-8 characters in some files. Refactor builder.py to clean up the code and remove the need to have a temporary file. Update other scripts to use the new code.
This commit is contained in:
@@ -147,20 +147,9 @@ class ModuleManager(builder.ModuleManager):
|
||||
self.script += line + os.linesep
|
||||
|
||||
def write(self):
|
||||
try:
|
||||
out = tempfile.NamedTemporaryFile(delete = False)
|
||||
try:
|
||||
out.write(bytes(self.script, sys.stdin.encoding))
|
||||
except:
|
||||
out.write(self.script)
|
||||
out.close()
|
||||
wscript = builder.RTEMS_DIR + '/libbsd_waf.py'
|
||||
builder.processIfDifferent(out.name, wscript, "libbsd_waf.py")
|
||||
finally:
|
||||
try:
|
||||
os.remove(out.name)
|
||||
except:
|
||||
pass
|
||||
name = os.path.join(builder.RTEMS_DIR, 'libbsd_waf.py')
|
||||
converter = builder.Converter()
|
||||
converter.convert(name, name, src_contents = self.script)
|
||||
|
||||
def setGenerators(self):
|
||||
self.generator['convert'] = builder.Converter
|
||||
|
Reference in New Issue
Block a user