Flutter Engine
The Flutter Engine
Functions | Variables
cacheimages Namespace Reference

Functions

def convertImgs (infile)
 
def Flags ()
 
def main ()
 

Variables

 SWARM_PATH = dirname(abspath(__file__))
 
 CLIENT_PATH = dirname(dirname(SWARM_PATH))
 
 CLIENT_TOOLS_PATH = join(CLIENT_PATH, 'tools')
 
string converter = CLIENT_TOOLS_PATH + '/htmlconverter.py'
 

Function Documentation

◆ convertImgs()

def cacheimages.convertImgs (   infile)

Definition at line 23 of file cacheimages.py.

23def convertImgs(infile):
24 global options
25 try:
26 htmlconverter.convertForOffline(infile,
27 infile,
28 verbose=options.verbose,
29 encode_images=options.inline_images)
30 print('Converted ' + infile)
31 except BaseException as e:
32 print('Caught error: %s' % e)
33
34
def convertImgs(infile)
Definition: cacheimages.py:23
def print(*args, **kwargs)
Definition: run_tests.py:49

◆ Flags()

def cacheimages.Flags ( )
 Constructs a parser for extracting flags from the command line. 

Definition at line 35 of file cacheimages.py.

35def Flags():
36 """ Constructs a parser for extracting flags from the command line. """
37 parser = optparse.OptionParser()
38 parser.add_option(
39 "--inline_images",
40 help=("Encode img payloads as data:// URLs rather than local files."),
41 default=False,
42 action='store_true')
43 parser.add_option("--verbose",
44 help="Print verbose output",
45 default=False,
46 action="store_true")
47 return parser
48
49
def Flags()
Definition: cacheimages.py:35

◆ main()

def cacheimages.main ( )

Definition at line 50 of file cacheimages.py.

50def main():
51 global options
52 parser = Flags()
53 options, args = parser.parse_args()
54 print("args: %s" % args)
55 if len(args) < 1 or 'help' in args[0]:
56 print('Usage: %s DIRECTORY' % basename(sys.argv[0]))
57 return 1
58
59 dirname = args[0]
60 print('Searching directory ' + dirname)
61
62 files = []
63 for root, dirs, fnames in os.walk(dirname):
64 for fname in fnames:
65 if fname.endswith('.html'):
66 files.append(join(root, fname))
67
68 count = 4 * multiprocessing.cpu_count()
69 pool = multiprocessing.Pool(processes=count)
70 # Note: need a timeout to get keyboard interrupt due to a Python bug
71 pool.map_async(convertImgs, files).get(3600) # one hour
72
73
def main()
Definition: cacheimages.py:50
basename
Definition: malisc.py:23
const myers::Point & get(const myers::Segment &)
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

Variable Documentation

◆ CLIENT_PATH

cacheimages.CLIENT_PATH = dirname(dirname(SWARM_PATH))

Definition at line 13 of file cacheimages.py.

◆ CLIENT_TOOLS_PATH

cacheimages.CLIENT_TOOLS_PATH = join(CLIENT_PATH, 'tools')

Definition at line 14 of file cacheimages.py.

◆ converter

string cacheimages.converter = CLIENT_TOOLS_PATH + '/htmlconverter.py'

Definition at line 19 of file cacheimages.py.

◆ SWARM_PATH

cacheimages.SWARM_PATH = dirname(abspath(__file__))

Definition at line 12 of file cacheimages.py.