mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-08 06:14:16 +02:00
[web] refactoring: faster Electron cache verification
This commit is contained in:
@@ -211,13 +211,11 @@ class EnvironmentUpdater:
|
|||||||
if not os.path.exists(ELECTRON_CACHE_DIR):
|
if not os.path.exists(ELECTRON_CACHE_DIR):
|
||||||
self.logger.info(f"Electron cache directory {ELECTRON_CACHE_DIR} not found")
|
self.logger.info(f"Electron cache directory {ELECTRON_CACHE_DIR} not found")
|
||||||
else:
|
else:
|
||||||
files = {f for f in glob.glob(f'{ELECTRON_CACHE_DIR}/**', recursive=True) if os.path.isfile(f)}
|
files = {os.path.basename(f) for f in glob.glob(f'{ELECTRON_CACHE_DIR}/**', recursive=True) if os.path.isfile(f)}
|
||||||
|
|
||||||
if files:
|
if files:
|
||||||
electron_url = self._get_electron_url(version, is_x86_x64_arch, widevine)
|
electron_url = self._get_electron_url(version, is_x86_x64_arch, widevine)
|
||||||
electron_file_name = os.path.basename(electron_url)
|
res['electron'] = os.path.basename(electron_url) in files
|
||||||
file_path_found = [f for f in files if os.path.basename(f) == electron_file_name]
|
|
||||||
res['electron'] = bool(file_path_found)
|
|
||||||
res['sha256'] = res['electron']
|
res['sha256'] = res['electron']
|
||||||
else:
|
else:
|
||||||
self.logger.info(f"No Electron file found in '{ELECTRON_CACHE_DIR}'")
|
self.logger.info(f"No Electron file found in '{ELECTRON_CACHE_DIR}'")
|
||||||
|
|||||||
Reference in New Issue
Block a user