blob: 56c0a96eb004aec6bf225b260f5e07faf16d6b1d [file] [log] [blame]
Dave Borowitzb6522312014-07-29 12:40:55 -07001import os
2import sys
3
4def include_bucklets(names):
5 d = os.getcwd()
6 while not os.path.lexists(os.path.join(d, '.buckversion')):
7 d = os.path.dirname(d)
8
9 bd = os.path.join(d, 'bucklets')
10 if not os.path.isdir(bd) or not os.listdir(bd):
11 sys.stderr.write(('Bucklets directory is missing or empty: %s\n'
12 'Run `git submodule update --init`') % bd)
13 sys.exit(1)
14
15 for name in names:
16 path = os.path.join(bd, name)
17 if not os.path.isfile(path):
18 sys.stderr.write('Missing bucklet: %s\n' % path)
19 sys.exit(1)
20 include_defs('//bucklets/%s' % name)