Merge branch 'staging' into svg

# Conflicts:
#	CHANGELOG.md
This commit is contained in:
Vinícius Moreira
2020-01-09 12:38:44 -03:00
13 changed files with 56 additions and 40 deletions

View File

@@ -1,8 +1,7 @@
import os
from bauh.api.constants import HOME_PATH
from pathlib import Path
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
LOCAL_PATH = '{}/.local/share/bauh/appimage'.format(HOME_PATH)
LOCAL_PATH = '{}/.local/share/bauh/appimage'.format(Path.home())
INSTALLATION_PATH = LOCAL_PATH + '/installed/'
SUGGESTIONS_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/appimage/suggestions.txt'

View File

@@ -20,15 +20,14 @@ from bauh.api.abstract.handler import ProcessWatcher
from bauh.api.abstract.model import SoftwarePackage, PackageHistory, PackageUpdate, PackageSuggestion, \
SuggestionPriority
from bauh.api.abstract.view import MessageType
from bauh.api.constants import HOME_PATH
from bauh.commons.html import bold
from bauh.commons.system import SystemProcess, new_subprocess, ProcessHandler, run_cmd, SimpleProcess
from bauh.gems.appimage import query, INSTALLATION_PATH, LOCAL_PATH, SUGGESTIONS_FILE
from bauh.gems.appimage.config import read_config
from bauh.gems.appimage.model import AppImage
from bauh.gems.appimage.query import FIND_APPS_BY_NAME, FIND_APPS_BY_NAME_ONLY_NAME
from bauh.gems.appimage.worker import DatabaseUpdater
HOME_PATH = str(Path.home())
DB_APPS_PATH = '{}/{}'.format(HOME_PATH, '.local/share/bauh/appimage/apps.db')
DB_RELEASES_PATH = '{}/{}'.format(HOME_PATH, '.local/share/bauh/appimage/releases.db')

View File

@@ -1,6 +1,7 @@
import os
from pathlib import Path
from bauh.api.constants import CACHE_PATH, HOME_PATH, CONFIG_PATH
from bauh.api.constants import CACHE_PATH, CONFIG_PATH
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
BUILD_DIR = '/tmp/bauh/aur'
@@ -8,7 +9,7 @@ ARCH_CACHE_PATH = CACHE_PATH + '/arch'
CATEGORIES_CACHE_DIR = ARCH_CACHE_PATH + '/categories'
CATEGORIES_FILE_PATH = CATEGORIES_CACHE_DIR + '/aur.txt'
URL_CATEGORIES_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/aur/categories.txt'
CONFIG_DIR = '{}/.config/bauh/arch'.format(HOME_PATH)
CONFIG_DIR = '{}/.config/bauh/arch'.format(Path.home())
CUSTOM_MAKEPKG_FILE = '{}/makepkg.conf'.format(CONFIG_DIR)
AUR_INDEX_FILE = '{}/aur.txt'.format(BUILD_DIR)
CONFIG_FILE = '{}/arch.yml'.format(CONFIG_PATH)

View File

@@ -1,7 +1,7 @@
import os
from pathlib import Path
from bauh.api.constants import HOME_PATH, DESKTOP_ENTRIES_DIR, CONFIG_PATH
from bauh.api.constants import DESKTOP_ENTRIES_DIR, CONFIG_PATH
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
WEB_PATH = '{}/.local/share/bauh/web'.format(Path.home())
@@ -13,7 +13,7 @@ NODE_BIN_PATH = '{}/bin/node'.format(NODE_DIR_PATH)
NPM_BIN_PATH = '{}/bin/npm'.format(NODE_DIR_PATH)
NODE_MODULES_PATH = '{}/node_modules'.format(ENV_PATH)
NATIVEFIER_BIN_PATH = '{}/.bin/nativefier'.format(NODE_MODULES_PATH)
ELECTRON_PATH = '{}/.cache/electron'.format(HOME_PATH)
ELECTRON_PATH = '{}/.cache/electron'.format(Path.home())
ELECTRON_DOWNLOAD_URL = 'https://github.com/electron/electron/releases/download/v{version}/electron-v{version}-linux-{arch}.zip'
ELECTRON_SHA256_URL = 'https://github.com/electron/electron/releases/download/v{version}/SHASUMS256.txt'
URL_ENVIRONMENT_SETTINGS = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/web/environment.yml'

View File

@@ -137,10 +137,10 @@ class WebApplicationManager(SoftwareManager):
return description
def _get_fix_for(self, url_no_protocol: str) -> str:
try:
fix_url = URL_FIX_PATTERN.format(url=url_no_protocol)
res = self.http_client.get(fix_url)
fix_url = URL_FIX_PATTERN.format(url=url_no_protocol)
try:
res = self.http_client.get(fix_url, session=False)
if res:
return res.text
except Exception as e:
@@ -156,7 +156,7 @@ class WebApplicationManager(SoftwareManager):
headers = {'Accept-language': self._get_lang_header(), 'User-Agent': UA_CHROME}
try:
url_res = self.http_client.get(url, headers=headers, ignore_ssl=True, single_call=True)
url_res = self.http_client.get(url, headers=headers, ignore_ssl=True, single_call=True, session=False)
if url_res:
return BeautifulSoup(url_res.text, 'lxml', parse_only=SoupStrainer('head'))
@@ -529,11 +529,11 @@ class WebApplicationManager(SoftwareManager):
def _download_suggestion_icon(self, pkg: WebApplication, app_dir: str) -> Tuple[str, bytes]:
try:
if self.http_client.exists(pkg.icon_url):
if self.http_client.exists(pkg.icon_url, session=False):
icon_path = '{}/{}'.format(app_dir, pkg.icon_url.split('/')[-1])
try:
res = self.http_client.get(pkg.icon_url)
res = self.http_client.get(pkg.icon_url, session=False)
if not res:
self.logger.info('Could not download the icon {}'.format(pkg.icon_url))
else:
@@ -756,7 +756,7 @@ class WebApplicationManager(SoftwareManager):
if not app.description:
app.description = self._get_app_description(app.url, soup)
find_url = not app.icon_url or (app.icon_url and not self.http_client.exists(app.icon_url))
find_url = not app.icon_url or (app.icon_url and not self.http_client.exists(app.icon_url, session=False))
if find_url:
app.icon_url = self._get_app_icon_url(app.url, soup)

View File

@@ -19,7 +19,7 @@ class SuggestionsDownloader:
def download(self) -> dict:
self.logger.info("Reading suggestions from {}".format(URL_SUGGESTIONS))
try:
suggestions = self.http_client.get_yaml(URL_SUGGESTIONS)
suggestions = self.http_client.get_yaml(URL_SUGGESTIONS, session=False)
if suggestions:
self.logger.info("{} suggestions successfully read".format(len(suggestions)))