2021-08-31 09:16:11 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
2022-03-29 23:52:52 +00:00
|
|
|
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2021-08-31 09:16:11 +00:00
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import optparse
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
# d.ts directories to be deleted
|
2022-02-19 09:18:41 +00:00
|
|
|
remove_list = ["@internal", "common", "form", "liteWearable", "config", "syscapCheck"]
|
2021-08-31 09:16:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
# traversal all fill in project folder
|
|
|
|
def copy_files(input_path, output_path):
|
|
|
|
for file in os.listdir(input_path):
|
|
|
|
src = os.path.join(input_path, file)
|
|
|
|
dst = os.path.join(output_path, file)
|
|
|
|
if os.path.isdir(src) and (not file in remove_list):
|
|
|
|
shutil.copytree(src, dst, dirs_exist_ok=True)
|
2022-03-16 13:57:20 +00:00
|
|
|
elif os.path.isfile(src):
|
2021-08-31 09:16:11 +00:00
|
|
|
shutil.copy(src, dst)
|
|
|
|
|
|
|
|
|
|
|
|
def parse_args(args):
|
|
|
|
parser = optparse.OptionParser()
|
|
|
|
parser.add_option('--input', help='d.ts document input path')
|
|
|
|
parser.add_option('--output', help='d.ts document output path')
|
|
|
|
options, _ = parser.parse_args(args)
|
|
|
|
return options
|
|
|
|
|
|
|
|
|
|
|
|
def main(argv):
|
|
|
|
options = parse_args(argv)
|
|
|
|
if not os.path.exists(options.output):
|
|
|
|
os.makedirs(options.output)
|
|
|
|
copy_files(options.input, options.output)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2022-02-19 07:50:31 +00:00
|
|
|
exit(main(sys.argv))
|