mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 02:24: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:
|
||||
|
||||
@@ -299,7 +299,7 @@ class AppsTable(QTableWidget):
|
||||
self.setCellWidget(pkg.table_index, col, item)
|
||||
|
||||
def _set_col_version(self, col: int, pkg: PackageView):
|
||||
label_version = QLabel(pkg.model.version if pkg.model.version else '?')
|
||||
label_version = QLabel(str(pkg.model.version if pkg.model.version else '?'))
|
||||
label_version.setAlignment(Qt.AlignCenter)
|
||||
|
||||
item = QWidget()
|
||||
|
||||
@@ -215,4 +215,6 @@ address=adreça
|
||||
view.components.file_chooser.placeholder=Feu clic aquí per seleccionar
|
||||
files=fitxers
|
||||
all_files=tots els fitxers
|
||||
file_chooser.title=Selector de fitxers
|
||||
file_chooser.title=Selector de fitxers
|
||||
message.file.not_exist=Fitxer no existeix
|
||||
message.file.not_exist.body=El fitxer {} sembla no existir
|
||||
@@ -169,4 +169,6 @@ address=Adresse
|
||||
view.components.file_chooser.placeholder=Klicken Sie hier, um auszuwählen
|
||||
files=Dateien
|
||||
all_files=Alle Dateien
|
||||
file_chooser.title=Dateiauswahl
|
||||
file_chooser.title=Dateiauswahl
|
||||
message.file.not_exist=Datei existiert nicht
|
||||
message.file.not_exist.body=Die Datei {} scheint nicht zu existieren
|
||||
@@ -173,4 +173,6 @@ address=address
|
||||
view.components.file_chooser.placeholder=Click here to select
|
||||
files=files
|
||||
all_files=all files
|
||||
file_chooser.title=File selector
|
||||
file_chooser.title=File selector
|
||||
message.file.not_exist=File does not exist
|
||||
message.file.not_exist.body=The file {} seems not to exist
|
||||
@@ -214,4 +214,6 @@ address=dirección
|
||||
view.components.file_chooser.placeholder=Pulse aquí para seleccionar
|
||||
files=archivos
|
||||
all_files=todos los archivos
|
||||
file_chooser.title=Selector de archivos
|
||||
file_chooser.title=Selector de archivos
|
||||
message.file.not_exist=Archivo no existe
|
||||
message.file.not_exist.body=El archivo {} parece no existir
|
||||
@@ -170,4 +170,6 @@ address=indirizzo
|
||||
view.components.file_chooser.placeholder=Fai clic qui per selezionare
|
||||
files=files
|
||||
all_files=tutti i files
|
||||
file_chooser.title=Selettore file
|
||||
file_chooser.title=Selettore file
|
||||
message.file.not_exist=File non esiste
|
||||
message.file.not_exist.body=Il file {} sembra non esistere
|
||||
@@ -217,4 +217,6 @@ address=endereço
|
||||
view.components.file_chooser.placeholder=Clique aqui para selecionar
|
||||
files=arquivos
|
||||
all_files=todos os arquivos
|
||||
file_chooser.title=Seletor arquivos
|
||||
file_chooser.title=Seletor arquivos
|
||||
message.file.not_exist=Arquivo não existe
|
||||
message.file.not_exist.body=O arquivo {} parece não existir
|
||||
Reference in New Issue
Block a user