aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/write_file_size.py
blob: 880fb90644b5522fb5c96c522e6709a468f36f08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env python
import sys
import os.path

if __name__ == '__main__':
    output = sys.argv[1]
    size_sum = 0
    for filename in sys.argv[2:]:
        if os.path.exists(filename):
            size_sum += os.path.getsize(filename)
        else:
            sys.stderr.write('write_file_size.py: {0}: No such file or directory\n'.format(filename))
            sys.exit(1)
    with open(output, 'w') as f:
        f.write(str(size_sum))