Changeset 1aef190 in rtems_waf
- Timestamp:
- 06/16/16 03:28:52 (7 years ago)
- Branches:
- 8151754a5d6efd9b6be4d728f3633dc6a63672a9
- Children:
- eb6ff97
- Parents:
- b0afac0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
rtems.py
rb0afac0 r1aef190 36 36 rtems_default_version = None 37 37 rtems_filters = None 38 rtems_long_commands = False 38 39 39 40 def options(opt): … … 64 65 help = 'Print the commands as strings.') 65 66 66 def init(ctx, filters = None, version = None ):67 def init(ctx, filters = None, version = None, long_commands = False): 67 68 global rtems_filters 68 69 global rtems_default_version 70 global rtems_long_commands 69 71 70 72 # … … 77 79 # 78 80 rtems_default_version = version 81 82 # 83 # Set the long commands option. 84 # 85 rtems_long_commands = long_commands 79 86 80 87 try: … … 137 144 138 145 # 139 # Handle the show commands option.146 # Handle the configurable commands options. 140 147 # 141 148 if conf.options.show_commands: … … 143 150 else: 144 151 show_commands = 'no' 152 if rtems_long_commands and os.name == 'nt': 153 long_commands = 'yes' 154 else: 155 long_commands = 'no' 145 156 146 157 rtems_version, rtems_path, rtems_bin, rtems_tools, archs, arch_bsps = \ … … 168 179 169 180 conf.msg('Board Support Package', ab, 'YELLOW') 181 182 # 183 # Show and long commands support. 184 # 185 conf.env.SHOW_COMMANDS = show_commands 186 conf.env.LONG_COMMANDS = long_commands 187 188 conf.msg('Show commands', show_commands) 189 conf.msg('Long commands', long_commands) 170 190 171 191 arch = _arch_from_arch_bsp(ab) … … 251 271 bsp_configure(conf, ab) 252 272 253 #254 # Show commands support the user can supply.255 #256 conf.env.SHOW_COMMANDS = show_commands257 258 273 conf.setenv('', env) 259 274 … … 263 278 264 279 conf.env.SHOW_COMMANDS = show_commands 280 conf.env.LONG_COMMANDS = long_commands 265 281 266 282 def build(bld): 267 283 if bld.env.SHOW_COMMANDS == 'yes': 268 284 output_command_line() 285 if bld.env.LONG_COMMANDS == 'yes': 286 long_command_line() 269 287 270 288 def load_cpuopts(conf, arch_bsp, rtems_path): … … 548 566 Logs.info('%s' % cmd) 549 567 else: 550 Logs.info('%s' % ' '.join(cmd)) # here is the change 568 cmd = ' '.join(cmd) 569 Logs.info('(%d) %s' % (len(cmd), cmd)) # here is the change 551 570 Logs.debug('runner_env: kw=%s' % kw) 552 571 try: … … 574 593 575 594 Task.__str__ = display 595 596 # 597 # From the extras. Use this to support long command lines. 598 # 599 def long_command_line(): 600 def exec_command(self, cmd, **kw): 601 # workaround for command line length limit: 602 # http://support.microsoft.com/kb/830473 603 import tempfile 604 tmp = None 605 try: 606 if not isinstance(cmd, str) and len(str(cmd)) > 8192: 607 (fd, tmp) = tempfile.mkstemp(dir=self.generator.bld.bldnode.abspath()) 608 flat = ['"%s"' % x.replace('\\', '\\\\').replace('"', '\\"') for x in cmd[1:]] 609 try: 610 os.write(fd, ' '.join(flat).encode()) 611 finally: 612 if tmp: 613 os.close(fd) 614 # Line may be very long: 615 # Logs.debug('runner:' + ' '.join(flat)) 616 cmd = [cmd[0], '@' + tmp] 617 ret = super(self.__class__, self).exec_command(cmd, **kw) 618 finally: 619 if tmp: 620 os.remove(tmp) 621 return ret 622 for k in 'c cxx cprogram cxxprogram cshlib cxxshlib cstlib cxxstlib'.split(): 623 cls = Task.classes.get(k) 624 if cls: 625 derived_class = type(k, (cls,), {}) 626 derived_class.exec_command = exec_command 627 if hasattr(cls, 'hcode'): 628 derived_class.hcode = cls.hcode 576 629 577 630 def _find_tools(conf, arch, paths, tools):
Note: See TracChangeset
for help on using the changeset viewer.