NikGapps 3.13__py3-none-any.whl → 3.15__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
NikGapps/build/Build.py CHANGED
@@ -1,5 +1,8 @@
1
+ import concurrent.futures
1
2
  import os
3
+ from multiprocessing import cpu_count
2
4
  from pathlib import Path
5
+ from threading import Lock
3
6
 
4
7
  from NikGapps.helper import Config
5
8
  from NikGapps.helper.Package import Package
@@ -7,6 +10,7 @@ from NikGapps.helper.FileOp import FileOp
7
10
  from NikGapps.helper.Cmd import Cmd
8
11
  from NikGapps.helper.AppSet import AppSet
9
12
  from NikGapps.helper.Statics import Statics
13
+ from NikGapps.helper.T import T
10
14
 
11
15
 
12
16
  class Build:
@@ -15,115 +19,130 @@ class Build:
15
19
  # Just provide the package list, and it will pick them up from the directory and build them for you
16
20
  @staticmethod
17
21
  def build_from_directory(app_set_build_list, android_version, cached=False):
18
- source_directory = Config.CACHED_SOURCE if cached else Config.APK_SOURCE
22
+ if cached:
23
+ return app_set_build_list
24
+ building = T()
25
+ source_directory = Config.APK_SOURCE
19
26
  print(f"Building from {source_directory}")
20
27
  cmd = Cmd()
21
28
  app_set_list = []
22
- for app_set in app_set_build_list:
23
- app_set: AppSet
24
- name = app_set.title
25
- app_set_path = os.path.join(source_directory, name)
26
- package_list = []
27
- for package in app_set.package_list:
28
- package: Package
29
- print(f"Setting up {name}/{package.package_title}")
30
- pkg_to_build = package
31
- package_title = pkg_to_build.package_title
32
- pkg_path = os.path.join(str(app_set_path), package_title)
33
- file_dict = dict()
34
- folder_dict = dict()
35
- install_list = []
36
- package_name = None
37
- app_type = None
38
- primary_app_location = None
39
- delete_files_list = []
40
- delete_overlay_list = []
41
- if float(android_version) >= 12.1:
42
- overlay_directory = Config.OVERLAY_SOURCE
43
- overlay_dir = overlay_directory + Statics.dir_sep + f"{package_title}Overlay"
44
- if FileOp.dir_exists(overlay_dir):
45
- for file in Path(overlay_dir).rglob("*.apk"):
46
- pkg_files_path = "overlay" + Statics.dir_sep + Path(file).name
47
- install_list.append(pkg_files_path.replace("___", "/"))
48
- file_dict_value = str(pkg_files_path.replace("___", "/")).replace("\\", "/")
49
- value = str(file_dict_value).split("/")
50
- file_dict[str(file)] = "___" + "___".join(value[:len(value) - 1]) + "/" + value[
51
- len(value) - 1]
52
- for pkg_files in Path(pkg_path).rglob("*"):
53
- if Path(pkg_files).is_dir() or str(pkg_files).__contains__(".git") \
54
- or str(pkg_files).endswith(".gitattributes") or str(pkg_files).endswith("README.md"):
55
- continue
56
- if str(pkg_files).endswith(Statics.DELETE_FILES_NAME):
57
- for str_data in FileOp.read_string_file(pkg_files):
58
- delete_file = str_data[:-1]
59
- if delete_file not in pkg_to_build.delete_files_list:
60
- delete_files_list.append(delete_file)
61
- continue
62
- pkg_files_path = str(pkg_files)
63
- pkg_files_path = pkg_files_path[pkg_files_path.find("___") + 3:]
64
- if pkg_files_path.replace("\\", "/").__eq__(f"etc___permissions/{package.package_name}.xml"):
29
+ max_workers = cpu_count()
30
+ lock = Lock()
31
+
32
+ def process_package(app_set_obj, pkg_obj):
33
+ package_title = pkg_obj.package_title
34
+ app_set_path = os.path.join(source_directory, app_set_obj.title)
35
+ pkg_path = os.path.join(str(app_set_path), package_title)
36
+
37
+ print(f"Setting up {app_set_obj.title}/{package_title}")
38
+
39
+ file_dict = {}
40
+ folder_dict = {}
41
+ install_list = []
42
+ delete_files_list = []
43
+ delete_overlay_list = []
44
+ package_name = None
45
+ app_type = None
46
+ primary_app_location = None
47
+
48
+ if float(android_version) >= 12.1:
49
+ overlay_directory = Config.OVERLAY_SOURCE
50
+ overlay_dir = overlay_directory + Statics.dir_sep + f"{package_title}Overlay"
51
+ if FileOp.dir_exists(overlay_dir):
52
+ for file in Path(overlay_dir).rglob("*.apk"):
53
+ pkg_files_path = "overlay" + Statics.dir_sep + Path(file).name
54
+ install_list.append(pkg_files_path.replace("___", "/"))
55
+ file_dict_value = str(pkg_files_path.replace("___", "/")).replace("\\", "/")
56
+ value = str(file_dict_value).split("/")
57
+ file_dict[str(file)] = "___" + "___".join(value[:len(value) - 1]) + "/" + value[len(value) - 1]
58
+
59
+ for pkg_files in Path(pkg_path).rglob("*"):
60
+ if Path(pkg_files).is_dir() or str(pkg_files).__contains__(".git") \
61
+ or str(pkg_files).endswith(".gitattributes") or str(pkg_files).endswith("README.md"):
62
+ continue
63
+ if str(pkg_files).endswith(Statics.DELETE_FILES_NAME):
64
+ for str_data in FileOp.read_string_file(pkg_files):
65
+ delete_file = str_data.strip()
66
+ if delete_file not in delete_files_list:
67
+ delete_files_list.append(delete_file)
68
+ continue
69
+ pkg_files_path = str(pkg_files)
70
+ pkg_files_path = pkg_files_path[pkg_files_path.find("___") + 3:]
71
+ if pkg_files_path.replace("\\", "/").__eq__(f"etc___permissions/{pkg_obj.package_name}.xml"):
72
+ continue
73
+ if pkg_obj.package_name is not None and str(pkg_files_path).endswith(".apk") and not str(
74
+ pkg_files).__contains__("split_") and not str(pkg_files).__contains__("___m") \
75
+ and not str(pkg_files).__contains__("___overlay"):
76
+ primary_app_location = pkg_files.absolute()
77
+ package_name = cmd.get_package_details(primary_app_location, "name")
78
+ if str(primary_app_location).__contains__("___priv-app___"):
79
+ app_type = Statics.is_priv_app
80
+ elif str(primary_app_location).__contains__("___app___"):
81
+ app_type = Statics.is_system_app
82
+ for folder in FileOp.get_dir_list(pkg_files_path):
83
+ if folder.startswith("system") or folder.startswith("vendor") \
84
+ or folder.startswith("product") or folder.startswith("system_ext") \
85
+ or folder.startswith("overlay"):
65
86
  continue
66
- if pkg_to_build.package_name is not None and str(pkg_files_path).endswith(".apk") and not str(
67
- pkg_files).__contains__("split_") and not str(pkg_files).__contains__("___m") \
68
- and not str(pkg_files).__contains__("___overlay"):
69
- primary_app_location = pkg_files.absolute()
70
- package_name = cmd.get_package_details(primary_app_location, "name")
71
- # print("File: " + package_name)
72
- # package_version = cmd.get_package_details(primary_app_location, "versionName")
73
- # print("Package Version: " + package_version)
74
- # package_code = cmd.get_package_details(primary_app_location, "versionCode")
75
- # print("Package Code: " + package_code)
76
- if str(primary_app_location).__contains__("___priv-app___"):
77
- app_type = Statics.is_priv_app
78
- elif str(primary_app_location).__contains__("___app___"):
79
- app_type = Statics.is_system_app
80
- for folder in FileOp.get_dir_list(pkg_files_path):
81
- if folder.startswith("system") or folder.startswith("vendor") \
82
- or folder.startswith("product") or folder.startswith("system_ext") \
83
- or folder.startswith("overlay"):
84
- continue
85
- folder_dict[folder] = folder
86
- # We don't need this but for the sake of consistency
87
- if str(pkg_files_path).endswith("xml") or str(pkg_files_path).endswith("prop"):
88
- FileOp.convert_to_lf(str(pkg_files.absolute()))
89
- install_list.append(pkg_files_path.replace("___", "/"))
90
- file_dict_value = str(pkg_files_path.replace("___", "/")).replace("\\", "/")
91
- value = str(file_dict_value).split("/")
92
- file_dict[pkg_files.absolute()] = "___" + "___".join(value[:len(value) - 1]) + "/" + value[
93
- len(value) - 1]
94
- if primary_app_location is not None:
95
- title = os.path.basename(primary_app_location)[:-4]
96
- else:
97
- title = package_title
98
- pkg = Package(title, package_name, app_type, package_title)
99
- pkg.install_list = install_list
100
- pkg.partition = pkg_to_build.partition
101
- pkg.clean_flash_only = pkg_to_build.clean_flash_only
102
- pkg.file_dict = file_dict
103
- pkg.folder_dict = folder_dict
104
- pkg.addon_index = pkg_to_build.addon_index
105
- pkg.additional_installer_script = pkg_to_build.additional_installer_script
106
- pkg.primary_app_location = primary_app_location
107
- # Generate priv-app permissions whitelist
108
- if pkg.primary_app_location is not None and app_type == Statics.is_priv_app:
109
- permissions_list = cmd.get_white_list_permissions(primary_app_location)
110
- for perm in pkg_to_build.priv_app_permissions:
111
- permissions_list.append(perm)
112
- if permissions_list.__len__() >= 1 and not permissions_list[0].__contains__("Exception"):
113
- pkg.priv_app_permissions_str = pkg.generate_priv_app_whitelist(app_set.title, permissions_list,
114
- android_version=android_version,
115
- pkg_path=source_directory)
116
- # Add the deleted files from the pkg_to_build object
117
- for delete_file in pkg_to_build.delete_files_list:
118
- delete_files_list.append(delete_file)
119
- pkg.delete_files_list = delete_files_list
120
- for delete_overlay in pkg_to_build.delete_overlay_list:
121
- delete_overlay_list.append(delete_overlay)
122
- pkg.delete_overlay_list = delete_overlay_list
123
- pkg.validation_script = pkg_to_build.validation_script
124
- pkg.overlay_list = pkg_to_build.overlay_list
125
- package_list.append(pkg)
126
- if package_list.__len__() > 0:
127
- app_set_to_build = AppSet(app_set.title, package_list)
128
- app_set_list.append(app_set_to_build)
87
+ folder_dict[folder] = folder
88
+ # We don't need this but for the sake of consistency
89
+ if str(pkg_files_path).endswith("xml") or str(pkg_files_path).endswith("prop"):
90
+ FileOp.convert_to_lf(str(pkg_files.absolute()))
91
+ install_list.append(pkg_files_path.replace("___", "/"))
92
+ file_dict_value = str(pkg_files_path.replace("___", "/")).replace("\\", "/")
93
+ value = str(file_dict_value).split("/")
94
+ file_dict[pkg_files.absolute()] = "___" + "___".join(value[:len(value) - 1]) + "/" + value[
95
+ len(value) - 1]
96
+
97
+ if primary_app_location is not None:
98
+ title = os.path.basename(primary_app_location)[:-4]
99
+ else:
100
+ title = package_title
101
+
102
+ # Create a new Package object with the gathered data
103
+ pkg = Package(title, package_name, app_type, package_title)
104
+ pkg.install_list = install_list
105
+ pkg.partition = pkg_obj.partition
106
+ pkg.clean_flash_only = pkg_obj.clean_flash_only
107
+ pkg.file_dict = file_dict
108
+ pkg.folder_dict = folder_dict
109
+ pkg.addon_index = pkg_obj.addon_index
110
+ pkg.additional_installer_script = pkg_obj.additional_installer_script
111
+ pkg.primary_app_location = primary_app_location
112
+
113
+ if pkg.primary_app_location is not None and app_type == Statics.is_priv_app:
114
+ permissions_list = cmd.get_white_list_permissions(primary_app_location)
115
+ for perm in pkg_obj.priv_app_permissions:
116
+ permissions_list.append(perm)
117
+ if permissions_list and not permissions_list[0].__contains__("Exception"):
118
+ pkg.priv_app_permissions_str = pkg.generate_priv_app_whitelist(app_set_obj.title, permissions_list,
119
+ android_version=android_version,
120
+ pkg_path=source_directory)
121
+ pkg.delete_files_list = delete_files_list
122
+ pkg.delete_overlay_list = delete_overlay_list
123
+ pkg.validation_script = pkg_obj.validation_script
124
+ pkg.overlay_list = pkg_obj.overlay_list
125
+
126
+ return pkg
127
+
128
+ with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
129
+ app_set_futures = {}
130
+
131
+ for app_set in app_set_build_list:
132
+ futures = []
133
+ for pkg_object in app_set.package_list:
134
+ future = executor.submit(process_package, app_set, pkg_object)
135
+ futures.append(future)
136
+ app_set_futures[app_set.title] = futures
137
+
138
+ for app_set_title, futures in app_set_futures.items():
139
+ package_list = []
140
+ for future in concurrent.futures.as_completed(futures):
141
+ package_list.append(future.result())
142
+
143
+ if package_list:
144
+ with lock:
145
+ app_set_to_build = AppSet(app_set_title, package_list)
146
+ app_set_list.append(app_set_to_build)
147
+ print(f"Total Time Taken: {building.taken()}")
129
148
  return app_set_list
NikGapps/build/Release.py CHANGED
@@ -51,7 +51,6 @@ class Release:
51
51
  config_obj.config_package_list = []
52
52
  z = Export(file_name=file_name, sign=sign_zip)
53
53
  zip_result = z.zip(config_obj=config_obj, send_zip_device=Config.SEND_ZIP_DEVICE,
54
- fresh_build=Config.FRESH_BUILD,
55
54
  telegram=telegram, compression_mode=Modes.DEFAULT)
56
55
  if zip_result[1] and Config.UPLOAD_FILES:
57
56
  print(f"Uploading {zip_result[0]}")
NikGapps/helper/FileOp.py CHANGED
@@ -2,14 +2,13 @@ import hashlib
2
2
  import os.path
3
3
  import shutil
4
4
  import stat
5
-
6
- from .Statics import Statics
5
+ from pathlib import Path
7
6
 
8
7
 
9
8
  class FileOp:
10
9
  @staticmethod
11
10
  def create_file_dir(file_path):
12
- parent_dir = str(Statics.get_parent_path(file_path))
11
+ parent_dir = str(Path(file_path).parent)
13
12
  if not os.path.exists(parent_dir):
14
13
  os.makedirs(parent_dir)
15
14
 
@@ -14,7 +14,8 @@ class Statics:
14
14
  '12': {'sdk': '31', 'code': 'S'},
15
15
  '12.1': {'sdk': '32', 'code': 'SL'},
16
16
  '13': {'sdk': '33', 'code': 'T'},
17
- '14': {'sdk': '34', 'code': 'U'}
17
+ '14': {'sdk': '34', 'code': 'U'},
18
+ '15': {'sdk': '35', 'code': 'V'},
18
19
  }
19
20
  is_system_app = 1
20
21
  is_priv_app = 2
@@ -1,11 +1,12 @@
1
1
  import os
2
2
  import platform
3
+ import shutil
3
4
  import subprocess
4
- from datetime import datetime
5
+ from multiprocessing import cpu_count
5
6
 
6
7
  import psutil
7
- import pytz
8
8
 
9
+ from . import Config
9
10
  from .Assets import Assets
10
11
  from .P import P
11
12
  from .T import T
@@ -35,6 +36,38 @@ class SystemStat:
35
36
  else:
36
37
  P.green(f"{location}: {time_str}")
37
38
 
39
+ @staticmethod
40
+ def get_disk_usage(path="/"):
41
+ total, used, free = shutil.disk_usage(path)
42
+ return total, used, free
43
+
44
+ @staticmethod
45
+ def print_disk_usage():
46
+ os_type = platform.system()
47
+
48
+ if os_type == "Windows":
49
+ # On Windows, you can specify a drive letter, e.g., "C:\\"
50
+ path = "C:\\"
51
+ total, used, free = SystemStat.get_disk_usage(path)
52
+ elif os_type == "Linux" or os_type == "Darwin":
53
+ # On Linux and macOS, use the root path
54
+ path = "/"
55
+ total, used, free = SystemStat.get_disk_usage(path)
56
+ else:
57
+ print(f"Unsupported OS: {os_type}")
58
+ return
59
+
60
+ # Convert bytes to gigabytes
61
+ total_gb = total / (2 ** 30)
62
+ used_gb = used / (2 ** 30)
63
+ free_gb = free / (2 ** 30)
64
+
65
+ print(f"Operating System: {os_type}")
66
+ print(f"Disk Usage for {path}")
67
+ print(f"Total: {total_gb:.2f} GiB")
68
+ print(f"Used: {used_gb:.2f} GiB")
69
+ print(f"Free: {free_gb:.2f} GiB")
70
+
38
71
  @staticmethod
39
72
  def show_stats():
40
73
  # Memory and CPU info
@@ -43,20 +76,20 @@ class SystemStat:
43
76
  total_ram_in_gb = round(mem.total / 1073741824, 2)
44
77
  P.green("---------------------------------------")
45
78
  P.green(f"Ram: {total_ram_in_bytes} bytes, {total_ram_in_gb} Gb")
46
- P.green(f"# of CPUs: {os.cpu_count()}")
79
+ P.green(f"# of CPUs: {os.cpu_count()}({cpu_count()})")
47
80
  P.green("---------------------------------------")
48
- P.green(f"Running on system: {platform.system()}")
81
+ SystemStat.print_disk_usage()
49
82
  # Versions of Java, ADB, and AAPT
50
83
  # java_version = SystemStat.run_command(["java", "-version"])
51
- adb_version = SystemStat.run_command([f"{Assets.adb_path}", "version"])
52
- aapt_version = SystemStat.run_command([f"{Assets.aapt_path}", "version"])
53
- P.green("---------------------------------------")
54
84
  # P.green(f"Java version: {java_version}")
55
85
  # P.green("---------------------------------------")
56
- P.green(f"ADB version: {adb_version}")
86
+ if (not Config.ENVIRONMENT_TYPE == "production") and Config.ENVIRONMENT_TYPE == "dev":
87
+ adb_version = SystemStat.run_command([f"{Assets.adb_path}", "version"])
88
+ P.green("---------------------------------------")
89
+ P.green(f"ADB version: {adb_version}")
57
90
  P.green("---------------------------------------")
91
+ aapt_version = SystemStat.run_command([f"{Assets.aapt_path}", "version"])
58
92
  P.green(f"AAPT version: {aapt_version}")
59
-
60
93
  P.green("---------------------------------------")
61
94
  t = T()
62
95
  local_time = t.get_local_date_time("%a, %m/%d/%Y, %I:%M:%S %p")
@@ -1,14 +1,18 @@
1
- from .. import Config
2
- from ..P import P
3
- from ..FileOp import FileOp
4
- from ..Assets import Assets
5
- from ..Package import Package
6
- from ..AppSet import AppSet
7
- from ..Cmd import Cmd
1
+ import concurrent.futures
2
+ import concurrent.futures
8
3
  import os
9
- from .Zip import Zip
4
+ import threading
5
+ from multiprocessing import cpu_count
6
+ from threading import Lock
7
+
10
8
  from .CompOps import CompOps
11
9
  from .Modes import Modes
10
+ from .Zip import Zip
11
+ from .. import Config
12
+ from ..Assets import Assets
13
+ from ..Cmd import Cmd
14
+ from ..FileOp import FileOp
15
+ from ..P import P
12
16
  from ..Statics import Statics
13
17
  from ..T import T
14
18
  from ..web.TelegramApi import TelegramApi
@@ -21,111 +25,102 @@ class Export:
21
25
  self.z = Zip(self.file_name, sign=sign, private_key_path=Assets.private_key_pem)
22
26
 
23
27
  def zip(self, config_obj: NikGappsConfig, telegram: TelegramApi = TelegramApi(None, None),
24
- compression_mode=Modes.DEFAULT, send_zip_device=Config.SEND_ZIP_DEVICE, fresh_build=Config.FRESH_BUILD):
25
- app_set_list = config_obj.config_package_list
26
- config_string = config_obj.get_nikgapps_config()
27
- android_version = config_obj.android_version
28
- total_packages = 0
29
- print_progress = ""
28
+ compression_mode=Modes.DEFAULT, send_zip_device=Config.SEND_ZIP_DEVICE):
29
+
30
30
  build_zip = T()
31
+ app_set_list = config_obj.config_package_list
32
+ max_workers = cpu_count()
33
+ lock = Lock()
34
+ total_packages = sum(len(app_set.package_list) for app_set in app_set_list)
35
+ completed_packages = 0
31
36
  file_sizes = ""
32
37
  zip_execution_status = False
33
- arch = "" if config_obj.arch == "arm64" else "_" + config_obj.arch
34
- cache_source_dir = Statics.pwd + Statics.dir_sep + str(android_version) + arch + f"_{Config.RELEASE_TYPE}" + (
35
- f"_cached" if Config.USE_CACHED_APKS else "")
36
- try:
37
- app_set_count = len(app_set_list)
38
- app_set_index = 1
39
- telegram.message("- Gapps is building...")
38
+ telegram.message(f"Progress {0:.2f}% ({completed_packages}/{total_packages})")
39
+
40
+ def compress_and_add_file(appset, pakg, compressionmode):
41
+ nonlocal completed_packages
42
+ nonlocal file_sizes
43
+ thread_id = threading.get_ident()
44
+
45
+ pkg_zip_path = (
46
+ Statics.get_temp_packages_directory(config_obj.android_version, arch=config_obj.arch)
47
+ + Statics.dir_sep + "Packages" + Statics.dir_sep + str(pakg.package_title) + compressionmode
48
+ )
49
+ pkg_txt_path = pkg_zip_path.replace(compression_mode, "") + "_" + compression_mode[1:] + ".txt"
50
+
51
+ if Config.USE_CACHED_APKS:
52
+ print(f"Using cached package: {os.path.basename(pkg_zip_path)}")
53
+ cached_pkg_zip_path = os.path.join(Config.CACHED_SOURCE, appset.title,
54
+ f"{pakg.package_title}{compression_mode}")
55
+ if FileOp.file_exists(cached_pkg_zip_path):
56
+ pkg_zip_path = cached_pkg_zip_path
57
+ pkg_txt_path = pkg_zip_path.replace(compression_mode, "") + "_" + compression_mode[
58
+ 1:] + ".txt"
59
+ else:
60
+ print(cached_pkg_zip_path + " doesn't exist!")
61
+ else:
62
+ CompOps.compress_package(pkg_zip_path, pakg, compression_mode)
63
+
64
+ for size_on_file in FileOp.read_string_file(pkg_txt_path):
65
+ pkg_size = size_on_file
66
+ pakg.pkg_size = pkg_size
67
+
68
+ with lock:
69
+ self.z.add_file(pkg_zip_path, f"AppSet/{appset.title}/{pakg.package_title}{compressionmode}")
70
+ file_sizes = file_sizes + str(pakg.package_title) + "=" + str(pakg.pkg_size) + "\n"
71
+ completed_packages += 1
72
+ progress = (completed_packages / total_packages) * 100
73
+ telegram.message(f"Progress {progress:.2f}% ({completed_packages}/{total_packages})",
74
+ replace_last_message=True)
75
+ P.blue(f"Progress {progress:.2f}% ({completed_packages}/{total_packages}): "
76
+ f"{appset.title}/{pakg.package_title} (Thread {thread_id})")
77
+
78
+ with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
79
+ futures = []
40
80
  for app_set in app_set_list:
41
- app_set: AppSet
42
- app_set_progress = round(float(100 * app_set_index / app_set_count))
43
- telegram.message(
44
- f"- Gapps is building... {str(app_set_progress)}% done",
45
- replace_last_message=True)
46
- package_count = len(app_set.package_list)
47
- package_index = 0
48
81
  for pkg in app_set.package_list:
49
- pkg_size = 0
50
- # Creating <Packages>.zip for all the packages
51
- pkg: Package
52
- package_progress = round(float(100 * package_index / package_count))
53
- pkg_zip_path = (Statics.get_temp_packages_directory(android_version, arch=config_obj.arch)
54
- + Statics.dir_sep + "Packages" + Statics.dir_sep + str(
55
- pkg.package_title) + compression_mode)
56
- pkg_txt_path = pkg_zip_path.replace(compression_mode, "") + "_" + compression_mode[1:] + ".txt"
57
- print_value = (f"AppSet ({str(app_set_progress)}%): {app_set.title} "
58
- f"Zipping ({str(package_progress)}%): {pkg.package_title}")
59
- print(print_value)
60
- print_progress = print_progress + "\n" + print_value
61
- if Config.USE_CACHED_APKS:
62
- print(f"Using cached package: {os.path.basename(pkg_zip_path)}")
63
- cached_pkg_zip_path = os.path.join(cache_source_dir, app_set.title,
64
- f"{pkg.package_title}{compression_mode}")
65
- if FileOp.file_exists(cached_pkg_zip_path):
66
- pkg_zip_path = cached_pkg_zip_path
67
- pkg_txt_path = pkg_zip_path.replace(compression_mode, "") + "_" + compression_mode[
68
- 1:] + ".txt"
69
- else:
70
- print(cached_pkg_zip_path + " doesn't exist!")
71
- else:
72
- CompOps.compress_package(pkg_zip_path, pkg, compression_mode)
73
- for size_on_file in FileOp.read_string_file(pkg_txt_path):
74
- pkg_size = size_on_file
75
- pkg.pkg_size = pkg_size
76
- self.z.add_file(pkg_zip_path,
77
- "AppSet/" + str(app_set.title) + "/" + str(pkg.package_title) + compression_mode)
78
- package_index = package_index + 1
79
- total_packages += 1
80
- file_sizes = file_sizes + str(pkg.package_title) + "=" + str(pkg_size) + "\n"
81
- app_set_index = app_set_index + 1
82
- # Writing additional script files to the zip
83
- self.z.add_string(self.get_installer_script(total_packages, app_set_list, compression_mode),
84
- "common/install.sh")
85
- self.z.add_string("#MAGISK", Statics.meta_inf_dir + "updater-script")
86
- self.z.add_file(Assets.magisk_update_binary, Statics.meta_inf_dir + "update-binary")
87
- self.z.add_string(config_string, "afzc/nikgapps.config")
88
- debloater_config_lines = ""
89
- for line in Assets.get_string_resource(Assets.debloater_config):
90
- debloater_config_lines += line
91
- for line in config_obj.debloater_list:
92
- debloater_config_lines += line + "\n"
93
- self.z.add_string(debloater_config_lines, "afzc/debloater.config")
94
- self.z.add_file(Assets.changelog, "changelog.yaml")
95
- self.z.add_file(Assets.addon_path, "common/addon.sh")
96
- self.z.add_file(Assets.header_path, "common/header.sh")
97
- self.z.add_file(Assets.functions_path, "common/functions.sh")
98
- self.z.add_string(file_sizes, "common/file_size.txt")
99
- self.z.add_file(Assets.nikgapps_functions, "common/nikgapps_functions.sh")
100
- self.z.add_file(Assets.mount_path, "common/mount.sh")
101
- self.z.add_file(Assets.mtg_mount_path, "common/mtg_mount.sh")
102
- self.z.add_file(Assets.unmount_path, "common/unmount.sh")
103
- self.z.add_string(os.path.basename(os.path.splitext(self.file_name)[0]), "zip_name.txt")
104
- self.z.add_string(f"Created by {config_obj.creator}".center(38, ' '), "creator.txt")
105
- self.z.add_string(self.get_customize_sh(self.file_name), "customize.sh")
106
- self.z.add_file(Assets.module_path, "module.prop")
107
- self.z.add_file(Assets.busybox, "busybox")
108
- zip_execution_status = True
109
- P.green('The zip ' + self.file_name + ' is created successfully!')
110
- except Exception as e:
111
- print("Exception occurred while creating the zip " + str(e))
112
- finally:
113
- self.z.close()
114
- time_taken = build_zip.taken("Total time taken to build the zip")
115
- telegram.message("- Completed in: " + T.format_time(round(time_taken)))
116
- file_name = self.file_name
117
- if send_zip_device:
118
- send_zip_device_time = T()
119
- cmd = Cmd()
120
- device_path = f"{Config.SEND_ZIP_LOCATION}/Afzc-" + str(
121
- android_version) + "/" + T.get_current_time() + "/" + os.path.basename(
122
- file_name)
123
- message = f"Sending {os.path.basename(file_name)} to device at: " + device_path
124
- print(message)
125
-
126
- cmd.push_package(file_name, device_path)
127
- send_zip_device_time.taken("Total time taken to send the zip to device")
128
- return file_name, zip_execution_status
82
+ futures.append(executor.submit(compress_and_add_file, app_set, pkg, compression_mode))
83
+
84
+ self.z.add_string(self.get_installer_script(total_packages, app_set_list, compression_mode),
85
+ "common/install.sh")
86
+ self.z.add_string("#MAGISK", Statics.meta_inf_dir + "updater-script")
87
+ self.z.add_file(Assets.magisk_update_binary, Statics.meta_inf_dir + "update-binary")
88
+ self.z.add_string(config_obj.get_nikgapps_config(), "afzc/nikgapps.config")
89
+ debloater_config_lines = ""
90
+ for line in Assets.get_string_resource(Assets.debloater_config):
91
+ debloater_config_lines += line
92
+ for line in config_obj.debloater_list:
93
+ debloater_config_lines += line + "\n"
94
+ self.z.add_string(debloater_config_lines, "afzc/debloater.config")
95
+ self.z.add_file(Assets.changelog, "changelog.yaml")
96
+ self.z.add_file(Assets.addon_path, "common/addon.sh")
97
+ self.z.add_file(Assets.header_path, "common/header.sh")
98
+ self.z.add_file(Assets.functions_path, "common/functions.sh")
99
+ self.z.add_string(file_sizes, "common/file_size.txt")
100
+ self.z.add_file(Assets.nikgapps_functions, "common/nikgapps_functions.sh")
101
+ self.z.add_file(Assets.mount_path, "common/mount.sh")
102
+ self.z.add_file(Assets.mtg_mount_path, "common/mtg_mount.sh")
103
+ self.z.add_file(Assets.unmount_path, "common/unmount.sh")
104
+ self.z.add_string(os.path.basename(os.path.splitext(self.file_name)[0]), "zip_name.txt")
105
+ self.z.add_string(f"Created by {config_obj.creator}".center(38, ' '), "creator.txt")
106
+ self.z.add_string(self.get_customize_sh(self.file_name), "customize.sh")
107
+ self.z.add_file(Assets.module_path, "module.prop")
108
+ self.z.add_file(Assets.busybox, "busybox")
109
+ self.z.close()
110
+ zip_execution_status = True
111
+ P.green('The zip ' + self.file_name + ' is created successfully!')
112
+ time_taken = build_zip.taken("Total time taken to build the zip")
113
+ telegram.message("- Completed in: " + T.format_time(round(time_taken)))
114
+ if send_zip_device:
115
+ send_zip_device_time = T()
116
+ cmd = Cmd()
117
+ device_path = f"{Config.SEND_ZIP_LOCATION}/Afzc-" + str(
118
+ config_obj.android_version) + "/" + T.get_current_time() + "/" + os.path.basename(self.file_name)
119
+ message = f"Sending {os.path.basename(self.file_name)} to device at: " + device_path
120
+ print(message)
121
+ cmd.push_package(self.file_name, device_path)
122
+ send_zip_device_time.taken("Total time taken to send the zip to device")
123
+ return self.file_name, zip_execution_status
129
124
 
130
125
  @staticmethod
131
126
  def get_installer_script(total_packages, app_set_list, compression_mode=Modes.DEFAULT):
NikGapps/main.py CHANGED
@@ -3,7 +3,6 @@ from NikGapps.build.Release import Release
3
3
  from NikGapps.helper.Args import Args
4
4
  from NikGapps.helper import Config
5
5
  from NikGapps.helper.SystemStat import SystemStat
6
- from NikGapps.helper.P import P
7
6
  from NikGapps.helper.T import T
8
7
  from NikGapps.helper.compression.Modes import Modes
9
8
  from NikGapps.helper.git.GitOperations import GitOperations
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: NikGapps
3
- Version: 3.13
3
+ Version: 3.15
4
4
  Summary: A short description of your project
5
5
  Home-page: https://github.com/nikgapps/project
6
6
  Author: Nikhil Menghani
@@ -3,15 +3,15 @@ NikGapps/build_config.py,sha256=rPJqsSuzHZfZXTYfIoIyJ62kIlao5ytyJQQqAIVwNgQ,3103
3
3
  NikGapps/cache.py,sha256=VBp5T4_DKGxdBtWrLfaBVXFTi4LeI24L-31CszLhVYs,4124
4
4
  NikGapps/config_upload.py,sha256=0HE7txm73XXxat_cR0JDXWtQUmg1IYK_SktwJS6N34s,652
5
5
  NikGapps/copy_repos.py,sha256=5YygTyuFW-DRnLPLGVcndQO6JqBW4JsN7O6cVWDQ4pE,1379
6
- NikGapps/main.py,sha256=bUatevHVBbu88VtJUFCiMhEQ1bLC4xQuKPdU7e5OC3w,2684
6
+ NikGapps/main.py,sha256=o10A9vjGN-C6kFf0BynssIybpuC8bRPon_49DWBUPYg,2652
7
7
  NikGapps/overlay_control.py,sha256=57m6DvzOczttXyfo8QAFeXGZo1TynB4w6Gjf1i0scfY,2873
8
8
  NikGapps/test.py,sha256=eXEeyM5xOpSKyUjb7OTP8BL37bqTE0eTKwnD1zT33rY,687
9
- NikGapps/build/Build.py,sha256=XBMAVce8VzsmVwLxo7fj8y8yBrpdVT-FFuaZ9LBWtxY,7917
9
+ NikGapps/build/Build.py,sha256=5ru8mOUpZTJNqjfeVkppUPEvbj8XqMcdaGZlR74IOw4,7547
10
10
  NikGapps/build/NikGappsManager.py,sha256=U9eCJj8Gzj9wvondtaKyz77AiK0mkSzpKAjOZY50HhA,18643
11
11
  NikGapps/build/NikGappsOverlays.py,sha256=ApyO2bnPpsG80uEvuB_XoeVn7TRDGCCWtl5myJcVrFI,526
12
12
  NikGapps/build/NikGappsPackages.py,sha256=samBrWZxNWVi5U28vgvfRNENLSdbK37oYo1oe2EI-HA,56928
13
13
  NikGapps/build/PackageConstants.py,sha256=-vmkiAWXoD5Ba1lmqd71ueEkivY7ne0zXSU3dzCfYLc,15847
14
- NikGapps/build/Release.py,sha256=Ask__sJzxzJyZhzDsUq5zi8N3J5W3ZLbwzdmLo0fdko,4909
14
+ NikGapps/build/Release.py,sha256=FChsFVmrFndEuvNk5nc288KCkFONUJ7SwsphgejVER4,4846
15
15
  NikGapps/build/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  NikGapps/config/NikGappsConfig.py,sha256=TSfwPWqxR4SE80lz-Jrn41yuTfSQcwi-jFh7iGmZFQQ,20411
17
17
  NikGapps/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -23,12 +23,12 @@ NikGapps/helper/C.py,sha256=MvRvtXLu-gjsJIXcMH73CSdbf_R-_LrmqS-ZKOtLrCU,354
23
23
  NikGapps/helper/Cmd.py,sha256=Fc4mywiDrJk9MI_Pw1Ow26gdpFL23D8EF2XbB1WmyBo,13540
24
24
  NikGapps/helper/Config.py,sha256=iCTMt5Zd3g3Rq0Y14u4i5e2-hCv9SKcSl4xMJ1KhYJE,2606
25
25
  NikGapps/helper/ConfigObj.py,sha256=ep9--o1SPgGXkElrjkf7hjF96KGSrmcQ9oGCpicN7D4,462
26
- NikGapps/helper/FileOp.py,sha256=rl0XnQxGuPpZqV50VZ_2uKWwgrhAjRmbrllXheBSiEg,7859
26
+ NikGapps/helper/FileOp.py,sha256=vPgXFBUdzDCo36OyHLCn8Jt62Fhf29_OPPwvh6kv7Sc,7842
27
27
  NikGapps/helper/Json.py,sha256=pgkXXHMBGs0Pl6YjTXjDSqPdIXryWzl5c0YyR-2YPYQ,973
28
28
  NikGapps/helper/P.py,sha256=S3dTkLQcOhS1SEE9WZVIVQUAVtSIGhO8TDH72SxWLb8,516
29
29
  NikGapps/helper/Package.py,sha256=yYOm5kUf_a6HOo1UA78_qkm2b0pqn5RCPqLt4yR3B10,9236
30
- NikGapps/helper/Statics.py,sha256=BsUwa66wlZb74iS8z6TD9q7kMegU3ypGq6YwDXEdJy8,6850
31
- NikGapps/helper/SystemStat.py,sha256=tRxEHAJYkTrJ4xNk4iL3O0vFdUkNKRv3CCLoLvhgJKs,2891
30
+ NikGapps/helper/Statics.py,sha256=dU19il9CmBO2QTksQH-Zo5qh6JFzJG1Z9gY4_Qgl8TM,6893
31
+ NikGapps/helper/SystemStat.py,sha256=f5H5L8FOZVLe-7SKYdCtjnjVXsgaJ2Eo9c3akiYjJLM,4074
32
32
  NikGapps/helper/T.py,sha256=tp2VAVfy_lbIJKIbYsGFtDck65BUo8JiHqOokpkpaKE,2898
33
33
  NikGapps/helper/XmlOp.py,sha256=ZcaO6JSriNDiOvom6gs6XwucnFInjIXaigUiehgVpQY,1632
34
34
  NikGapps/helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -70,7 +70,7 @@ NikGapps/helper/assets/bin/Windows/aapt2.exe,sha256=a9gpiuyjWXrN-hy5ccATpT9gFXRu
70
70
  NikGapps/helper/assets/bin/Windows/aapt_64.exe,sha256=03cpoqV1bV_-cLR988i4VLK3Nwi9KvP5jTWCII02s0Y,1704960
71
71
  NikGapps/helper/assets/bin/Windows/adb.exe,sha256=LacPG0nNZJNWiYVnNTfKU13r3TGeo60pOd9YFQVE9Mo,3233280
72
72
  NikGapps/helper/compression/CompOps.py,sha256=ZcmtU957E0BOU1yKQKXvwHNK3Xtp6BIyXBjjvz0Rq6E,1768
73
- NikGapps/helper/compression/Export.py,sha256=2XvurJzl6Jaa99Qs8qNBxTVZ_CUXJ0tBcyJAXb1Isho,10178
73
+ NikGapps/helper/compression/Export.py,sha256=9T9ul5euwLHXJEYfnniAydjBwGiUPrKWZbT-yVUxqWg,9237
74
74
  NikGapps/helper/compression/Modes.py,sha256=ifHezKw2uiBgmY33_7es_ox-WBHENYxdRB11jwVLOvU,71
75
75
  NikGapps/helper/compression/Tar.py,sha256=ooXkLJ1Ow0Ap9rhT_yMoOs7KalYA9CTC6-UVh9RpVsA,794
76
76
  NikGapps/helper/compression/Zip.py,sha256=4dDQIFyyewdeBTnO6ZnLkJrY7AvAeMqwYWWAcIiuSuQ,3766
@@ -99,9 +99,9 @@ NikGapps/helper/upload/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
99
99
  NikGapps/helper/web/Requests.py,sha256=HaZUHe_xi_7LjPLOYBUwK3uwOYOcVaW2E1zazjw2wow,5502
100
100
  NikGapps/helper/web/TelegramApi.py,sha256=XREdngh0vPvPMUOJsCJ3wSqXMFqS8q3qJUhmFMY6SH8,4743
101
101
  NikGapps/helper/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
102
- NikGapps-3.13.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
103
- NikGapps-3.13.dist-info/METADATA,sha256=_8mo_Kjnu2ZFdkG51Guu8vDllH3aFH0b479PcnIAwdw,4070
104
- NikGapps-3.13.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
105
- NikGapps-3.13.dist-info/entry_points.txt,sha256=iKbeOiuELwTDu5kmQHrU9XBVASWRR6_TuRIRva2UnAY,286
106
- NikGapps-3.13.dist-info/top_level.txt,sha256=CD7RpCb7bzjyvpQLt8hh2gU6X1wj3Z0NIErVkg-nJI4,9
107
- NikGapps-3.13.dist-info/RECORD,,
102
+ NikGapps-3.15.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
103
+ NikGapps-3.15.dist-info/METADATA,sha256=TqpCkmeU0XPkz_aZnwhO2kGaaMvmiU6VCt-m3NcE1tc,4070
104
+ NikGapps-3.15.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
105
+ NikGapps-3.15.dist-info/entry_points.txt,sha256=iKbeOiuELwTDu5kmQHrU9XBVASWRR6_TuRIRva2UnAY,286
106
+ NikGapps-3.15.dist-info/top_level.txt,sha256=CD7RpCb7bzjyvpQLt8hh2gU6X1wj3Z0NIErVkg-nJI4,9
107
+ NikGapps-3.15.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.0.0)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5