diff --git a/src/download_main.py b/src/download_main.py index f8e2458..7179bcc 100644 --- a/src/download_main.py +++ b/src/download_main.py @@ -101,7 +101,7 @@ def download_all_packages(progress_bar, progress_label, download_location, insta traceback.print_exc() progress_label.set_text(f"Error processing {app_name}: {e}") print(f"Error processing {app_name}: {e}") - install_main.install_all_packages() + install_main.install_all_packages(data) except FileNotFoundError: progress_label.set_text(f"Config file not found.") print("Config file not found.") diff --git a/src/install_main.py b/src/install_main.py index 62e8a24..14214ec 100644 --- a/src/install_main.py +++ b/src/install_main.py @@ -1,4 +1,10 @@ +import json_main -def install_all_packages(): - print("installing!") \ No newline at end of file +def install_all_packages(data): + + json_main.check_package_consistency(data) + + print("installing!") + +def install_package(): diff --git a/src/json_main.py b/src/json_main.py index 4feaf7f..27d58f2 100644 --- a/src/json_main.py +++ b/src/json_main.py @@ -58,6 +58,23 @@ def save_package(version, app, source_type, source_info, package_type): with open(data_location, 'w') as file: json.dump(data, file, indent=2) +def check_package_consistency(data): + browser_count = 0 + style_count = 0 + + for package in data.get("packages", []): + for app, app_data in package.items(): + if app_data["type"] == "browser": + browser_count += 1 + elif app_data["type"] == "style": + style_count += 1 + + if browser_count == 1 and style_count <= 1: + return True + else: + print("Warning: Inconsistent package counts.") + return False + # This function will get the package information for the given app. # If the app is not in .json, return an empty dictionary. def get_package(app):