summaryrefslogtreecommitdiffstats
path: root/freebsd-to-rtems.py
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2016-04-27 12:03:17 +1000
committerChris Johns <chrisj@rtems.org>2016-04-27 12:08:23 +1000
commitf1fcdba8631b0d792c865f9611b1890bc02bfbe0 (patch)
tree61186d81fa441424b11f95e88c84b6568be2fb4b /freebsd-to-rtems.py
parentAdd root bus support functions (diff)
downloadrtems-libbsd-f1fcdba8631b0d792c865f9611b1890bc02bfbe0.tar.bz2
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.
Diffstat (limited to 'freebsd-to-rtems.py')
-rwxr-xr-xfreebsd-to-rtems.py35
1 files changed, 17 insertions, 18 deletions
diff --git a/freebsd-to-rtems.py b/freebsd-to-rtems.py
index 77343779..6e6af263 100755
--- a/freebsd-to-rtems.py
+++ b/freebsd-to-rtems.py
@@ -87,7 +87,7 @@ def parseArguments():
sys.exit(2)
for o, a in opts:
if o in ("-v", "--verbose"):
- builder.isVerbose = True
+ builder.verboseLevel += 1
elif o in ("-h", "--help", "-?"):
usage()
sys.exit()
@@ -110,13 +110,14 @@ def parseArguments():
parseArguments()
-print("Verbose: " + ("no", "yes")[builder.isVerbose])
-print("Dry Run: " + ("no", "yes")[builder.isDryRun])
-print("Diff Mode Enabled: " + ("no", "yes")[builder.isDiffMode])
-print("Only Generate Build Scripts: " + ("no", "yes")[isOnlyBuildScripts])
-print("RTEMS Libbsd Directory: " + builder.RTEMS_DIR)
-print("FreeBSD SVN Directory: " + builder.FreeBSD_DIR)
-print("Direction: " + ("reverse", "forward")[isForward])
+print("Verbose: %s (%d)" % (("no", "yes")[builder.verbose()],
+ builder.verboseLevel))
+print("Dry Run: %s" % (("no", "yes")[builder.isDryRun]))
+print("Diff Mode Enabled: %s" % (("no", "yes")[builder.isDiffMode]))
+print("Only Generate Build Scripts: %s" % (("no", "yes")[isOnlyBuildScripts]))
+print("RTEMS Libbsd Directory: %s" % (builder.RTEMS_DIR))
+print("FreeBSD SVN Directory: %s" % (builder.FreeBSD_DIR))
+print("Direction: %s" % (("reverse", "forward")[isForward]))
# Check directory argument was set and exist
def wasDirectorySet(desc, path):
@@ -147,16 +148,14 @@ if isEarlyExit == True:
try:
waf_gen = waf_generator.ModuleManager()
-
libbsd.sources(waf_gen)
-
- # Perform the actual file manipulation
- if isForward:
- if not isOnlyBuildScripts:
- waf_gen.copyFromFreeBSDToRTEMS()
- waf_gen.generate(libbsd.rtems_version())
- else:
- waf_gen.copyFromRTEMSToFreeBSD()
+ if not isOnlyBuildScripts:
+ waf_gen.processSource(isForward)
+ waf_gen.generate(libbsd.rtems_version())
builder.changedFileSummary()
except IOError as ioe:
- print('error: %s' % (ioe))
+ print('error: %s' % (str(ioe)))
+except builder.error as be:
+ print('error: %s' % (be))
+except KeyboardInterrupt:
+ print('user abort')