Changeset f1fcdba in rtems-libbsd for freebsd-to-rtems.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
  • freebsd-to-rtems.py

    r5b93cc8 rf1fcdba  
    8888    for o, a in opts:
    8989        if o in ("-v", "--verbose"):
    90             builder.isVerbose = True
     90            builder.verboseLevel += 1
    9191        elif o in ("-h", "--help", "-?"):
    9292            usage()
     
    111111parseArguments()
    112112
    113 print("Verbose:                     " + ("no", "yes")[builder.isVerbose])
    114 print("Dry Run:                     " + ("no", "yes")[builder.isDryRun])
    115 print("Diff Mode Enabled:           " + ("no", "yes")[builder.isDiffMode])
    116 print("Only Generate Build Scripts: " + ("no", "yes")[isOnlyBuildScripts])
    117 print("RTEMS Libbsd Directory:      " + builder.RTEMS_DIR)
    118 print("FreeBSD SVN Directory:       " + builder.FreeBSD_DIR)
    119 print("Direction:                   " + ("reverse", "forward")[isForward])
     113print("Verbose:                     %s (%d)" % (("no", "yes")[builder.verbose()],
     114                                                builder.verboseLevel))
     115print("Dry Run:                     %s" % (("no", "yes")[builder.isDryRun]))
     116print("Diff Mode Enabled:           %s" % (("no", "yes")[builder.isDiffMode]))
     117print("Only Generate Build Scripts: %s" % (("no", "yes")[isOnlyBuildScripts]))
     118print("RTEMS Libbsd Directory:      %s" % (builder.RTEMS_DIR))
     119print("FreeBSD SVN Directory:       %s" % (builder.FreeBSD_DIR))
     120print("Direction:                   %s" % (("reverse", "forward")[isForward]))
    120121
    121122# Check directory argument was set and exist
     
    148149try:
    149150    waf_gen = waf_generator.ModuleManager()
    150 
    151151    libbsd.sources(waf_gen)
    152 
    153     # Perform the actual file manipulation
    154     if isForward:
    155         if not isOnlyBuildScripts:
    156             waf_gen.copyFromFreeBSDToRTEMS()
    157         waf_gen.generate(libbsd.rtems_version())
    158     else:
    159         waf_gen.copyFromRTEMSToFreeBSD()
     152    if not isOnlyBuildScripts:
     153        waf_gen.processSource(isForward)
     154    waf_gen.generate(libbsd.rtems_version())
    160155    builder.changedFileSummary()
    161156except IOError as ioe:
    162     print('error: %s' % (ioe))
     157    print('error: %s' % (str(ioe)))
     158except builder.error as be:
     159    print('error: %s' % (be))
     160except KeyboardInterrupt:
     161    print('user abort')
Note: See TracChangeset for help on using the changeset viewer.