Handle all plugin related artifacts. Args: plugin_list (list): List of plugin names layout (str): The display layout.
(plugin_list, layout)
| 214 | file_desc.write(result) |
| 215 | |
| 216 | def configure_plugins(plugin_list, layout): |
| 217 | """Handle all plugin related artifacts. |
| 218 | |
| 219 | Args: |
| 220 | plugin_list (list): List of plugin names |
| 221 | layout (str): The display layout. |
| 222 | """ |
| 223 | # Avoid generation if possible, because it will cause a compilation step. |
| 224 | is_generation_required = False |
| 225 | |
| 226 | if os.path.isdir(_WEB_DATA_PATH) is False: |
| 227 | os.mkdir(_WEB_DATA_PATH) |
| 228 | is_generation_required = True |
| 229 | |
| 230 | else: |
| 231 | # Remove all obsolete plugins in the web data if there are any. |
| 232 | if _clean_up_folders(plugin_list, _WEB_DATA_PATH) is True: |
| 233 | is_generation_required = True |
| 234 | |
| 235 | skip_list = [] |
| 236 | for plugin_name in plugin_list: |
| 237 | plugin_lib_path = _LIB_PATH + "/" + plugin_name |
| 238 | plugin_lib_web_path = plugin_lib_path + "/web" |
| 239 | |
| 240 | if os.path.isdir(plugin_lib_path) is False: |
| 241 | print(f"\tSkipping {plugin_name}, because {plugin_lib_path} doesn't exist.") |
| 242 | skip_list.append(plugin_name) |
| 243 | |
| 244 | elif os.path.isdir(plugin_lib_web_path) is False: |
| 245 | print(f"\tSkipping {plugin_name}, because {plugin_lib_web_path} doesn't exist.") |
| 246 | skip_list.append(plugin_name) |
| 247 | |
| 248 | else: |
| 249 | data_web_plugin_path = _WEB_DATA_PATH + "/" + plugin_name |
| 250 | |
| 251 | data_web_plugin_path_checksum = calculate_path_checksum([data_web_plugin_path]) |
| 252 | |
| 253 | src_files = [] |
| 254 | |
| 255 | plugin_lib_data = _load_json_file(plugin_lib_path + "/pixelix.json") |
| 256 | |
| 257 | if plugin_lib_data is None: |
| 258 | src_files = os.listdir(plugin_lib_web_path) |
| 259 | src_files = [plugin_lib_web_path + "/" + src_file for src_file in src_files] |
| 260 | else: |
| 261 | |
| 262 | if plugin_lib_data["pixelix"]["type"] != "plugin": |
| 263 | print(f"\tSkipping {plugin_name}, because its type isn't plugin in pixelix.json.") |
| 264 | skip_list.append(plugin_name) |
| 265 | |
| 266 | elif plugin_lib_data["pixelix"]["name"] != plugin_name: |
| 267 | print(f"\tSkipping {plugin_name}, because plugin name doesn't match with pixelix.json.") |
| 268 | |
| 269 | else: |
| 270 | web_files = plugin_lib_data["pixelix"]["web"]["files"] |
| 271 | layout_specific_files = [] |
| 272 | src_files = [plugin_lib_path + "/" + file_rel_path for file_rel_path in web_files] |
| 273 |
no test coverage detected