Changeset 2de37f3 in rtems-tools


Ignore:
Timestamp:
Mar 9, 2016, 3:27:42 AM (4 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, e9f48e9face6c4dea62712d73b35412c0fe10332
Children:
b7a9c81
Parents:
a5d243d
Message:

Python 2 and python 3 refactor fixes.

Updates #2619.

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • rtemstoolkit/config.py

    ra5d243d r2de37f3  
    4545import sys
    4646
     47#
     48# Support to handle use in a package and as a unit test.
     49# If there is a better way to let us know.
     50#
    4751try:
    4852    from . import error
     
    5256    from . import path
    5357except (ValueError, SystemError):
    54      import error
    55      import execute
    56      import log
    57      import options
    58      import path
     58    import error
     59    import execute
     60    import log
     61    import options
     62    import path
    5963
    6064def _check_bool(value):
     
    850854                                    long_opts = long_opts)
    851855        options.load(opts)
    852         if '_file' not in opts.defaults:
    853             raise error.general('no --file option provided')
    854856        s = file(opts.defaults['_file'], opts)
    855857        s.load(opts.defaults['_file'])
  • rtemstoolkit/execute.py

    ra5d243d r2de37f3  
    193193                    if len(data) == 0:
    194194                        break
    195                     if type(data) == bytes:
     195                    # str and bytes are the same type in Python2
     196                    if type(data) is not str and type(data) is bytes:
    196197                        data = data.decode(sys.stdout.encoding)
    197198                    for c in data:
  • rtemstoolkit/log.py

    ra5d243d r2de37f3  
    9090    lock.acquire()
    9191    for l in text.replace(chr(13), '').splitlines():
    92         print >> sys.stderr, l
     92        print(l, file = sys.stderr)
    9393    lock.release()
    9494
  • rtemstoolkit/macros.py

    ra5d243d r2de37f3  
    189189
    190190    def __setitem__(self, key, value):
     191        key = self._unicode_to_str(key)
    191192        if type(key) is not str:
    192193            raise TypeError('bad key type (want str): %s' % (type(key)))
  • tester/rt/test.py

    ra5d243d r2de37f3  
    100100        self.start_time = datetime.datetime.now()
    101101        try:
     102            xx
    102103            self.test = test(self.index, self.total, self.report,
    103104                             self.executable, self.rtems_tools,
     
    121122    def reraise(self):
    122123        if self.result is not None:
     124            with_tb = getattr(self.result[1], 'with_traceback', None)
     125            if with_tb:
     126                raise self.result[1].with_traceback(self.result[2])
    123127            raise (self.result[0], self.result[1], self.result[2])
    124128
Note: See TracChangeset for help on using the changeset viewer.