| Dave Borowitz | b652231 | 2014-07-29 12:40:55 -0700 | [diff] [blame] | 1 | import os |
| 2 | import sys |
| 3 | |
| 4 | def 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) |