blob: 67bf9cff037549c159c719d90b13cb70d9c1f070 [file] [log] [blame]
Hal Canarya58bcf72018-02-12 11:21:54 -05001#! /usr/bin/env python
2
3# Copyright 2018 Google Inc.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7import os
8import shutil
9import sys
10
11def gset(path):
12 s = set()
13 if os.path.isfile(path):
14 with open(path, 'r') as f:
15 for line in f:
16 s.add(line.strip())
17 return s
18
19def main():
20 assets = os.path.join('platform_tools', 'android', 'apps', 'skqp', 'src', 'main', 'assets')
21 os.chdir(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, assets))
22 known = gset('skqp/KnownGMs.txt')
23 nope = gset('skqp/DoNotScoreInCompatibilityTestMode.txt')
24 present = set(os.listdir('gmkb'))
25 to_delete = present & nope
26 if (known):
27 to_delete |= (present - known)
28 for x in to_delete:
29 shutil.rmtree(os.path.join('gmkb', x))
30 sys.stdout.write('%s: %d of %d models removed\n' %(sys.argv[0], len(to_delete), len(present)))
31
32if __name__ == '__main__':
33 main()
34