Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
generate_mbedignore.py
00001 # 00002 # DAPLink Interface Firmware 00003 # Copyright (c) 2009-2018, ARM Limited, All Rights Reserved 00004 # SPDX-License-Identifier: Apache-2.0 00005 # 00006 # Licensed under the Apache License, Version 2.0 (the "License"); you may 00007 # not use this file except in compliance with the License. 00008 # You may obtain a copy of the License at 00009 # 00010 # http://www.apache.org/licenses/LICENSE-2.0 00011 # 00012 # Unless required by applicable law or agreed to in writing, software 00013 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00014 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 # See the License for the specific language governing permissions and 00016 # limitations under the License. 00017 # 00018 00019 import os 00020 00021 def add_list_path(input_path_list, ouput_path_dict): 00022 for path_list in input_path_list: 00023 repath = os.path.normpath(path_list) 00024 if os.path.isfile(repath): 00025 dir_path = os.path.dirname(repath) 00026 if dir_path in ouput_path_dict: 00027 ouput_path_dict[dir_path].append(os.path.basename(repath)) 00028 else: 00029 ouput_path_dict[dir_path]= [os.path.basename(repath)] 00030 elif repath not in ouput_path_dict: #check if it's already in the folder filter list 00031 ouput_path_dict[repath]=[] 00032 00033 def generate_mbedignore(build_dicts, topsource = 'source', filename = '.mbedignore'): 00034 sources_tag = ['sources', 'includes'] 00035 sources_list = [] 00036 src_folder_file_dict = {} 00037 if 'common' in build_dicts: 00038 #do sources first 00039 for tag in sources_tag: 00040 if tag in build_dicts['common']: 00041 if type(build_dicts['common'][tag]) is dict: 00042 for srd_dir in build_dicts['common'][tag]: 00043 if type(build_dicts['common'][tag][srd_dir]) is list: 00044 add_list_path(build_dicts['common'][tag][srd_dir], src_folder_file_dict) 00045 elif type(build_dicts['common'][tag]) is list: 00046 add_list_path(build_dicts['common'][tag], src_folder_file_dict) 00047 ignore_list = [] 00048 for file in os.listdir("./"): 00049 if file != topsource: 00050 ignore_list.append(file) 00051 for root, dirs, files in os.walk(topsource): 00052 if root in src_folder_file_dict: 00053 if src_folder_file_dict[root] != []: 00054 for filter_file in files: 00055 if filter_file not in src_folder_file_dict[root] and not filter_file.endswith('.h'): 00056 ignore_list.append(os.path.join(root, filter_file)) 00057 continue 00058 else: 00059 for src_folder in src_folder_file_dict: 00060 if root in src_folder: 00061 for filter_file in files: 00062 ignore_list.append(os.path.join(root, filter_file)) 00063 break 00064 else: 00065 ignore_list.append(root) 00066 with open(filename, 'w') as ignore_file: 00067 for ignore_path in ignore_list: 00068 if os.path.isdir(ignore_path): 00069 ignore_path = os.path.join(ignore_path, '*') 00070 ignore_file.write(ignore_path+'\n')
Generated on Tue Jul 12 2022 15:37:18 by
