• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16import os
17import sys
18import optparse
19import shutil
20
21# d.ts directories to be deleted
22remove_list = ["@internal", "common", "form", "liteWearable", "config", "syscapCheck"]
23
24
25# traversal all fill in project folder
26def copy_files(input_path, output_path):
27    for file in os.listdir(input_path):
28        src = os.path.join(input_path, file)
29        dst = os.path.join(output_path, file)
30        if os.path.isdir(src) and (not file in remove_list):
31            shutil.copytree(src, dst, dirs_exist_ok=True)
32        elif os.path.isfile(src):
33            shutil.copy(src, dst)
34
35
36def parse_args(args):
37    parser = optparse.OptionParser()
38    parser.add_option('--input', help='d.ts document input path')
39    parser.add_option('--output', help='d.ts document output path')
40    options, _ = parser.parse_args(args)
41    return options
42
43
44def main(argv):
45    options = parse_args(argv)
46    if not os.path.exists(options.output):
47        os.makedirs(options.output)
48    copy_files(options.input, options.output)
49
50
51if __name__ == "__main__":
52    exit(main(sys.argv))
53