All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
check_build_deps.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 from subprocess import Popen, PIPE, call, STDOUT
4 import os
5 import sys
6 from datetime import datetime
7 
8 def getTargets():
9  '''
10  Retrieve the list of available targets.
11  '''
12  ignore = set(['all', 'install', 'install/local', 'install/strip',
13  'edit_cache', 'rebuild_cache', 'package', 'package_source',
14  'clean', 'depend', 'test', 'QMTestSummary',
15  'list_install_components', 'python.zip'])
16  targets = set()
17  for l in Popen(['make', 'help'], stdout=PIPE).stdout:
18  l = l.split()
19  if len(l) >= 2 and l[0] == '...':
20  targets.add(l[1])
21  return sorted(targets - ignore)
22 
23 
24 if __name__ == '__main__':
25  targets = sys.argv[1:] or getTargets()
26 
27  print 'Processing %d targets' % len(targets)
28  for target in targets:
29  call(['make', 'clean'], stdout=open(os.devnull, 'w'))
30  started = datetime.now()
31  sys.stdout.write('%s - %s ... ' %
32  (started.strftime('%Y-%m-%d %H:%M:%S'), target))
33  sys.stdout.flush()
34  retcode = Popen(['make', target],
35  stdout=open(target + '.build.log', 'w'),
36  stderr=STDOUT).wait()
37  if retcode:
38  print 'FAILED',
39  else:
40  print 'OK',
41  print datetime.now() - started