• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# Copyright (c) 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.
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        'codec_api.h',
25        'codec_app_def.h',
26        'codec_def.h',
27        'codec_ver.h',
28    ]
29    for header in headers:
30        src_file = os.path.join(src_dir, header)
31        file_tags = header.split('/')
32        if (len(file_tags) == 1):
33            des_file = os.path.join(dst_dir, header)
34        else:
35            des_file = os.path.join(dst_dir, file_tags[len(file_tags) - 1])
36        shutil.copy2(src_file, des_file)
37
38def main():
39    parser = argparse.ArgumentParser()
40    parser.add_argument('--src-dir', help='source path of wels header file', required=True)
41    parser.add_argument('--dst-dir', help='destion path of wels header file', required=True)
42    args = parser.parse_args()
43    print('copy from %s to %s', args.src_dir, args.dst_dir)
44    copy_file(args.src_dir, args.dst_dir)
45    return 0
46
47if __name__ == '__main__':
48    sys.exit(main())
49