interface_sdk-js/remove_internal.py
houhaoyu 39e7a810e0 houhaoyu@huawei.com
合规问题处理

Signed-off-by: houhaoyu <houhaoyu@huawei.com>
Change-Id: Ie3e29437f99423bc3b30a18c0f4aa69940c79a82
2022-03-30 07:52:52 +08:00

53 lines
1.7 KiB
Python
Executable File

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 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.
import os
import sys
import optparse
import shutil
# d.ts directories to be deleted
remove_list = ["@internal", "common", "form", "liteWearable", "config", "syscapCheck"]
# 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)
elif os.path.isfile(src):
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__":
exit(main(sys.argv))