summaryrefslogtreecommitdiff
path: root/rtemstoolkit/log.py
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2016-03-03 16:46:18 +1100
committerChris Johns <chrisj@rtems.org>2016-03-03 16:53:39 +1100
commitb0fa2ae9981b0ccf6a66cb8df2241caa5038eb36 (patch)
treed4f7f225cd35334ff18c3189bf1cdefa0d3335b4 /rtemstoolkit/log.py
parent0e5d89d9469fb755402cbabc09280557c7e01fcc (diff)
Update rtems-tool to support Python 2 and 3.
Add solaris and netbsd. Close #2619.
Diffstat (limited to 'rtemstoolkit/log.py')
-rwxr-xr-xrtemstoolkit/log.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/rtemstoolkit/log.py b/rtemstoolkit/log.py
index 1308203..61a3b02 100755
--- a/rtemstoolkit/log.py
+++ b/rtemstoolkit/log.py
@@ -1,6 +1,6 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2010-2014 Chris Johns (chrisj@rtems.org)
+# Copyright 2010-2016 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-testing'.
@@ -32,11 +32,20 @@
# Log output to stdout and/or a file.
#
+from __future__ import print_function
+
import os
import sys
import threading
-import error
+#
+# Support to handle use in a package and as a unit test.
+# If there is a better way to let us know.
+#
+try:
+ from . import error
+except (ValueError, SystemError):
+ import error
#
# A global log.
@@ -126,7 +135,7 @@ class log:
self.fhs[1] = sys.stderr
else:
try:
- self.fhs.append(file(s, 'w'))
+ self.fhs.append(open(s, 'w'))
except IOError as ioe:
raise error.general("creating log file '" + s + \
"': " + str(ioe))