summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py
blob: a2a05438d83675362e506e44696fbd85c2c6fc06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python

import glob
import os
import re
import sys


def file_modification_times(directory):
    for dirpath, dirnames, filenames in os.walk(directory):
        for filename in filenames:
            yield os.path.getmtime(os.path.join(dirpath, filename))


def main():
    vsprops_directory = os.path.join(os.environ['WEBKITLIBRARIESDIR'], 'tools', 'vsprops')
    newest_vsprops_time = max(file_modification_times(vsprops_directory))

    obj_directory = os.path.join(os.environ['WEBKITOUTPUTDIR'], 'obj')
    for manifest_file in glob.iglob(os.path.join(obj_directory, '*', '*', '*.manifest*')):
        manifest_time = os.path.getmtime(manifest_file)
        if manifest_time < newest_vsprops_time:
            os.remove(manifest_file)


if __name__ == '__main__':
    sys.exit(main())