wip package install

This commit is contained in:
admin 2024-01-18 16:55:07 +01:00
parent ec63a1ecb9
commit c1f5e027ea
3 changed files with 26 additions and 3 deletions

View file

@ -101,7 +101,7 @@ def download_all_packages(progress_bar, progress_label, download_location, insta
traceback.print_exc() traceback.print_exc()
progress_label.set_text(f"Error processing {app_name}: {e}") progress_label.set_text(f"Error processing {app_name}: {e}")
print(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: except FileNotFoundError:
progress_label.set_text(f"Config file not found.") progress_label.set_text(f"Config file not found.")
print("Config file not found.") print("Config file not found.")

View file

@ -1,4 +1,10 @@
import json_main
def install_all_packages(data):
json_main.check_package_consistency(data)
def install_all_packages():
print("installing!") print("installing!")
def install_package():

View file

@ -58,6 +58,23 @@ def save_package(version, app, source_type, source_info, package_type):
with open(data_location, 'w') as file: with open(data_location, 'w') as file:
json.dump(data, file, indent=2) 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. # This function will get the package information for the given app.
# If the app is not in .json, return an empty dictionary. # If the app is not in .json, return an empty dictionary.
def get_package(app): def get_package(app):