Changeset b7d48ef in rtems-tools for rtemstoolkit/macros.py


Ignore:
Timestamp:
Feb 8, 2015, 6:12:04 AM (5 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.11, master
Children:
9600c39
Parents:
7338811
Message:

Install the rtems-test command.

This installs the Python RTEMS Toolkit.

The copmiler has been switched from forcing gcc to allowing waf
to detect the host's tool chain.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rtemstoolkit/macros.py

    r7338811 rb7d48ef  
    3434
    3535import copy
     36import inspect
    3637import re
    3738import os
     
    7273            self.read_map_locked = False
    7374            self.write_map = 'global'
     75            self.rtpath = path.abspath(path.dirname(inspect.getfile(macros)))
     76            if path.dirname(self.rtpath).endswith('/share/rtems'):
     77                self.prefix = path.dirname(self.rtpath)[:-len('/share/rtems')]
     78            else:
     79                self.prefix = '.'
    7480            self.macros['global'] = {}
    7581            self.macros['global']['nil'] = ('none', 'none', '')
    76             self.macros['global']['_cwd'] = ('dir', 'required', path.abspath(os.getcwd()))
    77             self.macros['global']['_rtdir'] = ('dir', 'required', path.abspath(rtdir))
    78             self.macros['global']['_rttop'] = ('dir', 'required', path.abspath(path.dirname(rtdir)))
     82            self.macros['global']['_cwd'] = ('dir',
     83                                             'required',
     84                                             path.abspath(os.getcwd()))
     85            self.macros['global']['_prefix'] = ('dir', 'required', self.prefix)
     86            self.macros['global']['_rtdir'] = ('dir',
     87                                               'required',
     88                                               path.abspath(self.expand(rtdir)))
     89            self.macros['global']['_rttop'] = ('dir', 'required', self.prefix)
    7990        else:
    8091            self.macros = {}
     
    420431    def expand(self, _str):
    421432        """Simple basic expander of config file macros."""
     433        start_str = _str
    422434        expanded = True
     435        count = 0
    423436        while expanded:
     437            count += 1
     438            if count > 1000:
     439                raise error.general('expansion looped over 1000 times "%s"' %
     440                                    (start_str))
    424441            expanded = False
    425442            for m in self.macro_filter.findall(_str):
     
    427444                macro = self.get(name)
    428445                if macro is None:
    429                     print self.macros
    430446                    raise error.general('cannot expand default macro: %s in "%s"' %
    431447                                        (m, _str))
     
    475491    import copy
    476492    import sys
     493    print inspect.getfile(macros)
    477494    m = macros(name = 'defaults.mc')
    478495    d = copy.copy(m)
Note: See TracChangeset for help on using the changeset viewer.