Changeset fdbe9b7 in rtems


Ignore:
Timestamp:
Sep 28, 2020, 10:49:57 PM (4 weeks ago)
Author:
Ryan Long <ryan.long@…>
Branches:
5
Children:
40f23cea
Parents:
18549295
git-author:
Ryan Long <ryan.long@…> (09/28/20 22:49:57)
git-committer:
Joel Sherrill <joel@…> (09/29/20 12:59:31)
Message:

rtems-bsps: add ability to print architecture/bsp list

Closes #4099.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rtems-bsps

    r18549295 rfdbe9b7  
    263263                                self._out('%-*s |%s' % (max_bsp, bsp, family))
    264264
     265    def pairs(self, arch_selector=None, family_selector=None, show_path=False):
     266        """Generate output as pairs"""
     267        self._clear()
     268        max_arch = self._max_arch_len()
     269        max_bsp = self._max_bsp_len()
     270        if arch_selector is None:
     271            arch_matcher = []
     272        else:
     273            arch_matcher = [a.strip() for a in arch_selector.split(',')]
     274        if family_selector is None:
     275            family_matcher = []
     276        else:
     277            family_matcher = [f.strip() for f in family_selector.split(',')]
     278        for arch in sorted(self.archs.keys()):
     279            if arch_selector is None or arch in arch_matcher:
     280                for family in sorted(self.archs[arch].keys()):
     281                    if family_selector is None or family in family_matcher:
     282                        for bsp in sorted(self.archs[arch][family].keys()):
     283                            if show_path:
     284                                p = os.path.join('bsps',
     285                                                 self.archs[arch][family][bsp])
     286                                pair = arch + '/' + bsp
     287                                pair = '%-*s %s' % (max_arch + max_bsp + 1, pair, p)
     288
     289                                self._out(pair)
     290                            else:
     291                                self._out('%s/%s' % (arch, bsp))
     292
    265293
    266294def run(args):
     
    295323                       help='Verbose or trace for debugging',
    296324                       action='store_true')
     325    argsp.add_argument('-P',
     326                       '--pairs',
     327                       help='Output architectures and BSPs in CPU/BSP format',
     328                       action='store_true')
    297329
    298330    argopts = argsp.parse_args(args[1:])
     
    310342                    show_title=argopts.title)
    311343    else:
    312         ab.text(arch_selector=argopts.arch,
    313                 family_selector=argopts.family,
    314                 show_path=argopts.paths)
     344        if argopts.pairs:
     345            ab.pairs(arch_selector=argopts.arch,
     346                     family_selector=argopts.family,
     347                     show_path=argopts.paths)
     348        else:
     349            ab.text(arch_selector=argopts.arch,
     350                    family_selector=argopts.family,
     351                    show_path=argopts.paths)
    315352
    316353    print(os.linesep.join(ab.output()))
Note: See TracChangeset for help on using the changeset viewer.