@@ -0,0 +1,3006 @@
+#!/usr/bin/env python2%0A# -*- coding: utf-8 -*-%0A%0A# Copyright (C) 2014  Ren%C3%A9 Kijewski  %3Crene.kijewski@fu-berlin.de%3E%0A#%0A# This library is free software; you can redistribute it and/or%0A# modify it under the terms of the GNU Lesser General Public%0A# License as published by the Free Software Foundation; either%0A# version 2.1 of the License, or (at your option) any later version.%0A#%0A# This library is distributed in the hope that it will be useful,%0A# but WITHOUT ANY WARRANTY; without even the implied warranty of%0A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU%0A# Lesser General Public License for more details.%0A#%0A# You should have received a copy of the GNU Lesser General Public%0A# License along with this library; if not, write to the Free Software%0A# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA%0A%0Afrom __future__ import print_function%0A%0Afrom itertools import groupby, ifilter, imap%0Afrom os import devnull, environ, listdir%0Afrom os.path import abspath, dirname, isdir, join%0Afrom subprocess import PIPE, Popen%0Afrom sys import exit%0A%0Ariotbase = environ.get('RIOTBASE') or abspath(join(dirname(abspath(__file__)), '../' * 3))%0A%0Anull = open(devnull, 'w')%0A%0Asuccess = %5B%5D%0Afailed = %5B%5D%0Aexceptions = %5B%5D%0A%0Afor folder in ('examples', 'tests'):%0A    print('Building all applications in: %5C033%5B1;34m%7B%7D%5C033%5B0m'.format(folder))%0A    for application in sorted(listdir(join(riotbase, folder))):%0A        if not isdir(join(riotbase, folder, application)):%0A            continue%0A%0A        print('%5CtBuilding application: %5C033%5B1;34m%7B%7D%5C033%5B0m'.format(application))%0A        try:%0A            subprocess = Popen(('make', 'buildtest'),%0A                               stdout=PIPE,%0A                               stderr=null,%0A                               cwd=join(riotbase, folder, application))%0A            lines = imap(str.rstrip, subprocess.stdout)%0A            lines = ifilter(bool, lines)%0A            lines = imap(lambda s: s.split(' .. '), lines)%0A            lines = ifilter(lambda t: len(t) == 2, lines)%0A            lines = imap(lambda (board, outcome): (outcome, board%5Blen('Building for '):%5D), lines)%0A            lines = groupby(sorted(lines), lambda (outcome, board): outcome)%0A            for group, results in lines:%0A                print('%5Ct%5Ct%7B%7D: %7B%7D'.format(group, ', '.join(sorted(board for outcome, board in results))))%0A%0A            returncode = subprocess.wait()%0A            (failed if returncode else success).append(application)%0A        except Exception, e:%0A            print('%5Ct%5CtException: %7B%7D'.format(e))%0A            exceptions.append(application)%0A        finally:%0A            try:%0A                subprocess.kill()%0A            except:%0A                pass%0A%0Aprint('Outcome:')%0Afor color, group, applications in (('2', 'success', success), ('1', 'failed', failed), ('4', 'exceptions', exceptions)):%0A    if applications:%0A        print('%5Ct%5C033%5B1;3%7B%7Dm%7B%7D%5C033%5B0m: %7B%7D'.format(color, group, ', '.join(applications)))%0A%0Aif exceptions:%0A    exit(2)%0Aelif failed:%0A    exit(1)%0Aelse:%0A    exit(0)%0A

Add "compile everything" tool