fix: disk cache keeps enabled even with --disk-cache=0 | improving snaps launching | arch gem label as 'AUR' for now

This commit is contained in:
Vinicius Moreira
2019-09-19 18:04:04 -03:00
parent c8417b5315
commit 446463bddb
11 changed files with 52 additions and 16 deletions

View File

@@ -1,3 +1,4 @@
import logging
import re
import subprocess
import time
@@ -155,9 +156,36 @@ def refresh_and_stream(app_name: str, root_password: str) -> subprocess.Popen:
return new_root_subprocess([BASE_CMD, 'refresh', app_name], root_password)
def run(app: SnapApplication):
def run(app: SnapApplication, logger: logging.Logger):
info = get_info(app.name, 'commands')
app_name = app.name.lower()
if info.get('commands'):
subprocess.Popen([BASE_CMD, 'run', info['commands'][0]])
logger.info('Available commands found for {}: {}'.format(app_name, info['commands']))
commands = [c.strip() for c in info['commands']]
# trying to find an exact match command:
command = None
for c in commands:
if c.lower() == app_name:
command = c
logger.info("Found exact match command for '{}'".format(app_name))
break
if not command:
for c in command:
if not c.endswith('.apm'):
command = c
if command:
logger.info("Running '{}'".format(command))
subprocess.Popen([BASE_CMD, 'run', command])
return
logger.error("No valid command found for '{}'".format(app_name))
else:
logger.error("No command found for '{}'".format(app_name))