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 shutil 17import os 18import sys 19import argparse 20import subprocess 21 22 23def get_names(path: str, names: []): 24 for file_name in os.listdir(path): 25 full_path = os.path.join(path, file_name) 26 if os.path.isfile(full_path): 27 names.append(full_path) 28 else: 29 get_names(full_path, names) 30 31 32def endswith_check(names: [], suffix: str): 33 return any(name.endswith(suffix) for name in names) 34 35 36def main(): 37 parser = argparse.ArgumentParser() 38 parser.add_argument("--libPath", help="path of libs") 39 parser.add_argument("--hapPath", help="path of haps") 40 args = parser.parse_args() 41 42 lib_names = [] 43 get_names(args.libPath, lib_names) 44 45 hap_names = [] 46 get_names(args.hapPath, hap_names) 47 48 libentry = endswith_check(lib_names, "libentry.so") 49 assert libentry, "not found libentry.so" 50 51 default_hap = endswith_check(hap_names, "entry-default.hap") 52 assert default_hap, "not found entry-default.hap" 53 54 55if __name__ == '__main__': 56 sys.exit(main())