Home | History | Annotate | Download | only in skqp
      1 #! /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 
      7 import os
      8 import shutil
      9 import sys
     10 
     11 def 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 
     19 def 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 
     32 if __name__ == '__main__':
     33     main()
     34 
     35