Changeset f1fcdba in rtems-libbsd for waf_generator.py


Ignore:
Timestamp:
Apr 27, 2016, 2:03:17 AM (3 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
c1e05b9ea378b2971e3d7704779112b4bc4296da, freebsd-9.3, 4a77611a223ea883fb548679b516d326a020d447
Children:
3c7fdb2
Parents:
5b93cc8
git-author:
Chris Johns <chrisj@…> (04/27/16 02:03:17)
git-committer:
Chris Johns <chrisj@…> (04/27/16 02:08:23)
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waf_generator.py

    r5b93cc8 rf1fcdba  
    148148
    149149    def write(self):
    150         try:
    151             out = tempfile.NamedTemporaryFile(delete = False)
    152             try:
    153                 out.write(bytes(self.script, sys.stdin.encoding))
    154             except:
    155                 out.write(self.script)
    156             out.close()
    157             wscript = builder.RTEMS_DIR + '/libbsd_waf.py'
    158             builder.processIfDifferent(out.name, wscript, "libbsd_waf.py")
    159         finally:
    160             try:
    161                 os.remove(out.name)
    162             except:
    163                 pass
     150        name = os.path.join(builder.RTEMS_DIR, 'libbsd_waf.py')
     151        converter = builder.Converter()
     152        converter.convert(name, name, src_contents = self.script)
    164153
    165154    def setGenerators(self):
Note: See TracChangeset for help on using the changeset viewer.