Flutter Engine
The Flutter Engine
Functions | Variables
generate_page_set Namespace Reference

Functions

def main ()
 

Variables

string PAGE_SET_TEMPLATE = 'page_set_template'
 
string PAGE_SET_DIR = 'page_sets'
 

Function Documentation

◆ main()

def generate_page_set.main ( )

Definition at line 19 of file generate_page_set.py.

19def main():
20 created_page_sets = []
21 while True:
22 user_agent = raw_input('user agent? (mobile/desktop/tablet): ')
23 url_name = raw_input('URL name? (eg: google): ')
24 url = raw_input('URL? (eg: http://www.google.com): ')
25 comment = raw_input('Reason for adding the URL? (eg: go/skia-skps-3-2019): ')
26
27 with open(PAGE_SET_TEMPLATE) as f:
28 t = jinja2.Template(f.read())
29 subs = {
30 'user_agent': user_agent,
31 'url_name': url_name,
32 'url': url,
33 'comment': comment,
34 }
35
36 page_set_name = 'skia_%s_%s.py' % (url_name, user_agent)
37 page_set_path = os.path.join(PAGE_SET_DIR, page_set_name)
38 with open(page_set_path, 'w') as f:
39 f.write(t.render(**subs))
40 created_page_sets.append(page_set_path)
41 print('\nPage set has been created in %s\n\n' % page_set_path)
42
43 keep_going = raw_input('Do you have more page sets to create? (y/n)')
44 if keep_going != 'y':
45 break
46
47 print('\n\nSummarizing all created page sets:')
48 for page_set_path in created_page_sets:
49 print('* %s' % page_set_path)
50
51
def print(*args, **kwargs)
Definition: run_tests.py:49

Variable Documentation

◆ PAGE_SET_DIR

string generate_page_set.PAGE_SET_DIR = 'page_sets'

Definition at line 16 of file generate_page_set.py.

◆ PAGE_SET_TEMPLATE

string generate_page_set.PAGE_SET_TEMPLATE = 'page_set_template'

Definition at line 15 of file generate_page_set.py.