mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 05:14:16 +02:00
[web] checking if the electron files exist before downloading
This commit is contained in:
@@ -255,7 +255,7 @@ class WebApplicationManager(SoftwareManager):
|
||||
|
||||
if local_config['environment']['electron']['version']:
|
||||
for app in res.new:
|
||||
app.version = local_config['environment']['electron']['version']
|
||||
app.version = str(local_config['environment']['electron']['version'])
|
||||
app.latest_version = app.version
|
||||
|
||||
return res
|
||||
@@ -605,10 +605,10 @@ class WebApplicationManager(SoftwareManager):
|
||||
|
||||
watcher.change_substatus(self.i18n['web.install.substatus.call_nativefier'].format(bold('nativefier')))
|
||||
|
||||
electron_version = next((c for c in env_components if c.id == 'electron')).version
|
||||
electron_version = str(next((c for c in env_components if c.id == 'electron')).version)
|
||||
installed = handler.handle_simple(nativefier.install(url=pkg.url, name=app_id, output_dir=app_dir,
|
||||
electron_version=electron_version,
|
||||
system=local_config['environment']['system'],
|
||||
system=bool(local_config['environment']['system']),
|
||||
cwd=INSTALLED_PATH,
|
||||
extra_options=install_options))
|
||||
|
||||
@@ -838,7 +838,7 @@ class WebApplicationManager(SoftwareManager):
|
||||
thread_config.join()
|
||||
if local_config and local_config['environment']['electron']['version']:
|
||||
for s in res:
|
||||
s.package.version = local_config['environment']['electron']['version']
|
||||
s.package.version = str(local_config['environment']['electron']['version'])
|
||||
s.package.latest_version = s.package.version
|
||||
|
||||
return res
|
||||
|
||||
@@ -11,6 +11,7 @@ import yaml
|
||||
|
||||
from bauh.api.abstract.download import FileDownloader
|
||||
from bauh.api.abstract.handler import ProcessWatcher
|
||||
from bauh.api.abstract.view import MessageType
|
||||
from bauh.api.http import HttpClient
|
||||
from bauh.commons import system
|
||||
from bauh.commons.html import bold
|
||||
@@ -193,11 +194,27 @@ class EnvironmentUpdater:
|
||||
Path(ELECTRON_PATH).mkdir(parents=True, exist_ok=True)
|
||||
self.logger.info("Downloading Electron {}".format(version))
|
||||
electron_path = '{}/{}'.format(ELECTRON_PATH, url.split('/')[-1])
|
||||
|
||||
if not self.http_client.exists(url):
|
||||
self.logger.warning("The file {} seems not to exist".format(url))
|
||||
watcher.show_message(title=self.i18n['message.file.not_exist'],
|
||||
body=self.i18n['message.file.not_exist.body'].format(bold(url)),
|
||||
type_=MessageType.ERROR)
|
||||
return False
|
||||
|
||||
return self.file_downloader.download(file_url=url, watcher=watcher, output_path=electron_path, cwd=ELECTRON_PATH)
|
||||
|
||||
def download_electron_sha256(self, version: str, url: str, watcher: ProcessWatcher) -> bool:
|
||||
self.logger.info("Downloading Electron {} sha526".format(version))
|
||||
sha256_path = '{}/{}'.format(ELECTRON_PATH, url.split('/')[-1]) + '-{}'.format(version)
|
||||
|
||||
if not self.http_client.exists(url):
|
||||
self.logger.warning("The file {} seems not to exist".format(url))
|
||||
watcher.show_message(title=self.i18n['message.file.not_exist'],
|
||||
body=self.i18n['message.file.not_exist.body'].format(bold(url)),
|
||||
type_=MessageType.ERROR)
|
||||
return False
|
||||
|
||||
return self.file_downloader.download(file_url=url, watcher=watcher, output_path=sha256_path, cwd=ELECTRON_PATH)
|
||||
|
||||
def _get_electron_url(self, version: str, is_x86_x64_arch: bool) -> str:
|
||||
|
||||
Reference in New Issue
Block a user