Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
install_framework_headers.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2#
3# Copyright 2013 The Flutter Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7import argparse
8import errno
9import os
10import shutil
11import sys
12
13
14def main():
15 parser = argparse.ArgumentParser(
16 description='Removes existing files and installs the specified headers' +
17 'at the given location.'
18 )
19
20 parser.add_argument(
21 '--headers', nargs='+', help='The headers to install at the location.', required=True
22 )
23 parser.add_argument('--location', type=str, required=True)
24
25 args = parser.parse_args()
26
27 # Remove old headers.
28 try:
29 shutil.rmtree(os.path.normpath(args.location))
30 except OSError as err:
31 # Ignore only "not found" errors.
32 if err.errno != errno.ENOENT:
33 raise err
34
35 # Create the directory to copy the files to.
36 if not os.path.isdir(args.location):
37 os.makedirs(args.location)
38
39 # Copy all files specified in the args.
40 for header_file in args.headers:
41 shutil.copyfile(header_file, os.path.join(args.location, os.path.basename(header_file)))
42
43
44if __name__ == '__main__':
45 sys.exit(main())
Definition main.py:1