1#!/usr/bin/env python3 2# -*- coding: utf-8 -*- 3# Copyright (c) 2023 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. 15 16import argparse 17import os 18import sys 19import shutil 20import subprocess 21 22 23def main(): 24 parser = argparse.ArgumentParser() 25 parser.add_argument('--sdk-description-file', required=True) 26 parser.add_argument('--output-hap-build-sdk-desc-file', required=True) 27 28 options = parser.parse_args() 29 sys.path.append( 30 os.path.dirname( 31 os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) 32 from scripts.util.file_utils import read_json_file, write_json_file 33 info_list = read_json_file(options.sdk_description_file) 34 new_info_list = [] 35 for info in info_list: 36 if info.get("install_dir").startswith("previewer"): 37 continue 38 if "linux" not in info.get("target_os"): 39 continue 40 new_info_list.append(info) 41 write_json_file(options.output_hap_build_sdk_desc_file, new_info_list) 42 43 44if __name__ == '__main__': 45 sys.exit(main())