1 #!/usr/bin/env python 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 3 # Use of this source code is governed by a BSD-style license that can be 4 # found in the LICENSE file. 5 6 import parse_deps 7 import os 8 9 srcdir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../src")) 10 11 def generate_templates(): 12 all_filenames = [] 13 14 for dirpath, dirnames, filenames in os.walk(srcdir): 15 for f in filenames: 16 all_filenames.append(os.path.join(dirpath, f)) 17 18 filenames = [x for x in all_filenames if 19 os.path.splitext(x)[1] == ".html"] 20 filenames = [os.path.relpath(x) for x in filenames] 21 22 def ignored(x): 23 if os.path.basename(x).startswith('.'): 24 return True 25 if "tests.html" in x: 26 return True 27 if "about_tracing.html" in x: 28 return True 29 return False 30 filenames = [x for x in filenames if not ignored(x)] 31 32 templates = ''; 33 34 for filename in filenames: 35 f = open(filename, 'r') 36 templates += f.read() 37 f.close() 38 39 return templates 40