Flutter Engine
The Flutter Engine
Functions | Variables
svg_downloader Namespace Reference

Functions

def download_files (input_file, output_dir, prefix, keep_common_prefix)
 

Variables

 PARENT_DIR = os.path.dirname(os.path.realpath(__file__))
 
 option_parser = optparse.OptionParser()
 
 help
 
 default
 
 action
 
 options
 
 unused_args
 

Function Documentation

◆ download_files()

def svg_downloader.download_files (   input_file,
  output_dir,
  prefix,
  keep_common_prefix 
)

Definition at line 18 of file svg_downloader.py.

18def download_files(input_file, output_dir, prefix, keep_common_prefix):
19 with open(input_file, 'r') as f:
20 lines = f.readlines()
21
22 if keep_common_prefix:
23 common_prefix = os.path.commonprefix(lines)
24
25 for url in lines:
26 file_url = url.strip()
27
28 if keep_common_prefix:
29 rel_file = file_url.replace(common_prefix, '')
30 dest_dir = os.path.join(output_dir, os.path.dirname(rel_file))
31 else:
32 dest_dir = output_dir
33
34 dest_file = os.path.join(dest_dir, prefix + os.path.basename(file_url))
35 if not os.path.exists(dest_dir):
36 os.makedirs(dest_dir)
37
38 print('Downloading %s to %s' % (file_url, dest_file))
39 urllib.urlretrieve(file_url, dest_file)
40
41
def print(*args, **kwargs)
Definition: run_tests.py:49
def download_files(input_file, output_dir, prefix, keep_common_prefix)

Variable Documentation

◆ action

svg_downloader.action

Definition at line 60 of file svg_downloader.py.

◆ default

svg_downloader.default

Definition at line 48 of file svg_downloader.py.

◆ help

svg_downloader.help

Definition at line 46 of file svg_downloader.py.

◆ option_parser

svg_downloader.option_parser = optparse.OptionParser()

Definition at line 43 of file svg_downloader.py.

◆ options

svg_downloader.options

Definition at line 61 of file svg_downloader.py.

◆ PARENT_DIR

svg_downloader.PARENT_DIR = os.path.dirname(os.path.realpath(__file__))

Definition at line 15 of file svg_downloader.py.

◆ unused_args

svg_downloader.unused_args

Definition at line 61 of file svg_downloader.py.