[wgem] suggestions now can provide their own electron version

This commit is contained in:
Vinícius Moreira
2019-12-17 16:18:43 -03:00
parent 70bd76c52a
commit 9863cdb812
3 changed files with 22 additions and 6 deletions

View File

@@ -19,9 +19,9 @@ ELECTRON_SHA256_URL = 'https://github.com/electron/electron/releases/download/v{
URL_ENVIRONMENT_SETTINGS = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/web/environment.yml'
DESKTOP_ENTRY_PATH_PATTERN = DESKTOP_ENTRIES_DIR + '/bauh.web.{name}.desktop'
URL_FIX_PATTERN = "https://raw.githubusercontent.com/vinifmor/bauh-files/master/web/fix/{url}.js"
URL_SUGGESTIONS = "https://raw.githubusercontent.com/vinifmor/bauh-files/master/web/suggestions.yaml"
URL_SUGGESTIONS = "https://raw.githubusercontent.com/vinifmor/bauh-files/master/web/suggestions.yml"
UA_CHROME = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36'
TEMP_PATH = '/tmp/bauh/web'
SEARCH_INDEX_FILE = '{}/index.yaml'.format(TEMP_PATH)
SUGGESTIONS_CACHE_FILE = '{}/suggestions.yaml'.format(TEMP_PATH)
CONFIG_FILE = '{}/web.yaml'.format(CONFIG_PATH)
SEARCH_INDEX_FILE = '{}/index.yml'.format(TEMP_PATH)
SUGGESTIONS_CACHE_FILE = '{}/suggestions.yml'.format(TEMP_PATH)
CONFIG_FILE = '{}/web.yml'.format(CONFIG_PATH)

View File

@@ -489,8 +489,18 @@ class WebApplicationManager(SoftwareManager):
if system_env:
self.logger.warning("Using system's nativefier to install {}".format(pkg.url))
electron_version = self.env_settings['electron']['version']
if pkg.version and pkg.version != electron_version:
self.logger.info('A preset Electron version is defined for {}: {}'.format(pkg.url, pkg.version))
electron_version = pkg.version
if config['environment']['electron']['version']:
self.logger.warning("A custom Electron version will be used {} to install {}".format(electron_version, pkg.url))
electron_version = config['environment']['electron']['version']
installed = handler.handle_simple(nativefier.install(url=pkg.url, name=app_id, output_dir=app_dir,
electron_version=self.env_settings['electron']['version'],
electron_version=electron_version,
system=system_env,
cwd=INSTALLED_PATH,
extra_options=install_options))
@@ -644,6 +654,8 @@ class WebApplicationManager(SoftwareManager):
categories=[suggestion['category']] if suggestion.get('category') else None,
preset_options=suggestion.get('options'))
app.set_version(suggestion.get('version'))
description = suggestion.get('description')
if isinstance(description, dict):
@@ -651,7 +663,7 @@ class WebApplicationManager(SoftwareManager):
elif isinstance(description, str):
app.description = description
if self.env_settings and self.env_settings.get('electron'):
if not app.version and self.env_settings and self.env_settings.get('electron'):
app.version = self.env_settings['electron']['version']
app.latest_version = app.version

View File

@@ -20,6 +20,10 @@ class WebApplication(SoftwarePackage):
self.set_custom_icon(custom_icon)
self.preset_options = preset_options
def set_version(self, version: str):
self.version = str(version) if version else None
self.latest_version = version
def has_history(self):
return False