1#!/usr/bin/env python 2# -*- coding: utf-8 -*- 3# Copyright (c) 2021 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. 15import sys 16import argparse 17import os 18import shutil 19 20def copy_file(src_dir, dst_dir): 21 if not os.path.exists(dst_dir): 22 os.makedirs(dst_dir) 23 headers = [ 24 'basedefs.h', 25 'fs/iwdlsnr.h', 26 'fs/iwexfile.h', 27 'fs/iwfile.h', 28 'fs/iwfsmfile.h', 29 'iowow.h', 30 'json/iwbinn.h', 31 'json/iwjson_internal.h', 32 'json/iwjson.h', 33 'kv/iwkv.h', 34 'log/iwlog.h', 35 'platform/iwp.h', 36 'rdb/iwrdb.h', 37 're/iwre.h', 38 'tmpl/iwcfg.h', 39 'utils/iwarr.h', 40 'utils/iwbits.h', 41 'utils/iwconv.h', 42 'utils/iwhmap.h', 43 'utils/iwpool.h', 44 'utils/iwstw.h', 45 'utils/iwth.h', 46 'utils/iwutils.h', 47 'utils/iwuuid.h', 48 'utils/iwxstr.h', 49 'utils/murmur3.h', 50 'utils/utf8proc.h', 51 ] 52 for header in headers: 53 src_file = os.path.join(src_dir, header) 54 file_tags = header.split('/') 55 if (len(file_tags) == 1): 56 des_file = os.path.join(dst_dir, header) 57 else: 58 des_file = os.path.join(dst_dir, file_tags[len(file_tags) - 1]) 59 shutil.copy2(src_file, des_file) 60 61 62def main(): 63 parser = argparse.ArgumentParser() 64 parser.add_argument('--src-dir', help='source path of iowow header file', required=True) 65 parser.add_argument('--dst-dir', help='destion path of iowow header file', required=True) 66 args = parser.parse_args() 67 print('copy from %s to %s', args.src_dir, args.dst_dir) 68 copy_file(args.src_dir, args.dst_dir) 69 return 0 70 71if __name__ == '__main__': 72 sys.exit(main()) 73