Changeset f88fcf3 in rtems-source-builder for source-builder/sb/reports.py


Ignore:
Timestamp:
Mar 7, 2016, 12:56:02 AM (4 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.11
Children:
e02eaa6
Parents:
76188ee4
git-author:
Chris Johns <chrisj@…> (03/07/16 00:56:02)
git-committer:
Chris Johns <chrisj@…> (03/07/16 02:16:17)
Message:

sb: Update code base to support Python3 and Python2.

Fix Windows support to allow MSYS2 Python to be used.

Updates #2619.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source-builder/sb/reports.py

    r76188ee4 rf88fcf3  
    2323#
    2424
     25from __future__ import print_function
     26
    2527import copy
    2628import datetime
     
    4446    import version
    4547except KeyboardInterrupt:
    46     print 'user terminated'
     48    print('user terminated', file = sys.stderr)
    4749    sys.exit(1)
    4850except:
    49     print 'error: unknown application load error'
     51    print('error: unknown application load error', file = sys.stderr)
    5052    sys.exit(1)
    5153
     
    105107
    106108    def buildset_start(self, nest_level, name):
    107         self.line('=-' * (_line_len / 2))
     109        self.line('=-' * int(_line_len / 2))
    108110        self.line('Build Set: (%d) %s' % (nest_level, name))
    109111
     
    217219    def buildset_start(self, nest_level, name):
    218220        h = '%s' % (name)
    219         self.line('=%s %s' % ('=' * nest_level, h))
     221        self.line('=%s %s' % ('=' * int(nest_level), h))
    220222
    221223    def info(self, nest_level, name, info, separated):
     
    267269
    268270    def post_process(self):
    269         import StringIO
    270         infile = StringIO.StringIO(self.content)
    271         outfile = StringIO.StringIO()
     271        import io
     272        infile = io.StringIO(self.content)
     273        outfile = io.StringIO()
    272274        try:
    273275            import asciidocapi
     
    648650            if len(sources):
    649651                if 'sources' in tree:
    650                     tree['sources'] = dict(tree['sources'].items() + sources.items())
     652                    tree['sources'] = dict(list(tree['sources'].items()) + list(sources.items()))
    651653                else:
    652654                    tree['sources'] = sources
    653655            if len(patches):
    654656                if 'patches' in tree:
    655                     tree['patches'] = dict(tree['patches'].items() + patches.items())
     657                    tree['patches'] = dict(list(tree['patches'].items()) + list(patches.items()))
    656658                else:
    657659                    tree['patches'] = patches
     
    683685                for f in range(0, len(files) - 1):
    684686                    self.output('; %s  |- %s' % (prefix, files[f]))
    685                 if 'bset' in tree and len(tree['bset'].keys()):
     687                if 'bset' in tree and len(list(tree['bset'].keys())):
    686688                    c = '|'
    687689                else:
     
    718720
    719721    def generate_ini(self):
    720         nodes = sorted([node for node in self.tree.keys() if node != 'bset'])
     722        nodes = sorted([node for node in list(self.tree.keys()) if node != 'bset'])
    721723        self.output(';')
    722724        self.output('; Configuration Tree:')
     
    743745                o.close()
    744746                del o
    745             except IOError, err:
     747            except IOError as err:
    746748                raise error.general('writing output file: %s: %s' % (name, err))
    747749
     
    788790        if opts.get_arg('--output') and len(opts.params()) > 1:
    789791            raise error.general('--output can only be used with a single config')
    790         print 'RTEMS Source Builder, Reporter, %s' % (version.str())
     792        print('RTEMS Source Builder, Reporter, %s' % (version.str()))
    791793        opts.log_info()
    792794        if not check.host_setup(opts):
     
    828830        else:
    829831            raise error.general('invalid config type: %s' % (config))
    830     except error.general, gerr:
    831         print gerr
     832    except error.general as gerr:
     833        print(gerr)
    832834        sys.exit(1)
    833     except error.internal, ierr:
    834         print ierr
     835    except error.internal as ierr:
     836        print(ierr)
    835837        sys.exit(1)
    836     except error.exit, eerr:
     838    except error.exit as eerr:
    837839        pass
    838840    except KeyboardInterrupt:
Note: See TracChangeset for help on using the changeset viewer.