• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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        #'kv/iwal.h',
31        'kv/iwkv.h',
32        #'kv/iwkv_internal.h',
33        #'kv/tests/iwkv_tests.h',
34        'log/iwlog.h',
35        'platform/iwp.h',
36        #'platform/win32/mman/mman.h',
37        'rdb/iwrdb.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/iwsha2.h',
45        'utils/iwstree.h',
46        'utils/iwstw.h',
47        'utils/iwth.h',
48        'utils/iwutils.h',
49        'utils/iwuuid.h',
50        'utils/iwxstr.h',
51        #'utils/kbtree.h',
52        #'utils/khash.h',
53        #'utils/ksort.h',
54        #'utils/mt19937ar.h',
55        'utils/murmur3.h',
56        #'utils/pthread_spin_lock_shim.h'
57    ]
58    for header in headers:
59        src_file = os.path.join(src_dir, header)
60        file_tags = header.split('/')
61        if (len(file_tags) == 1):
62            des_file = os.path.join(dst_dir, header)
63        else:
64            des_file = os.path.join(dst_dir, file_tags[len(file_tags) - 1])
65        shutil.copy2(src_file, des_file)
66
67
68def main():
69    parser = argparse.ArgumentParser()
70    parser.add_argument('--src-dir', help='source path of iowow header file', required=True)
71    parser.add_argument('--dst-dir', help='destion path of iowow header file', required=True)
72    args = parser.parse_args()
73    print('copy from %s to %s', args.src_dir, args.dst_dir)
74    copy_file(args.src_dir, args.dst_dir)
75    return 0
76
77if __name__ == '__main__':
78    sys.exit(main())
79