[kernel-switcher] drop etpUi usage
This commit is contained in:
@@ -13,7 +13,7 @@ import errno
|
||||
import codecs
|
||||
import argparse
|
||||
|
||||
from entropy.const import etpUi, etpConst, const_convert_to_unicode, \
|
||||
from entropy.const import etpConst, const_convert_to_unicode, \
|
||||
const_convert_to_rawstring
|
||||
from entropy.output import teal, purple, darkgreen, blue, brown, print_info, \
|
||||
red, nocolor, print_warning, print_error
|
||||
@@ -118,11 +118,11 @@ def _guess_kernel_package_file(release_level):
|
||||
# removing and installing proprietary drivers might reset the selected
|
||||
# OpenGL implementation
|
||||
|
||||
def _get_opengl_impl():
|
||||
def _get_opengl_impl(pretend):
|
||||
eselect_exec = "/usr/bin/eselect"
|
||||
sts = 1
|
||||
out = "xorg-x11"
|
||||
if os.access(eselect_exec, os.X_OK) and not etpUi['pretend']:
|
||||
if os.access(eselect_exec, os.X_OK) and not pretend:
|
||||
sts, xout = entropy.tools.getstatusoutput("%s opengl show" % (
|
||||
eselect_exec,))
|
||||
if sts == 0:
|
||||
@@ -145,6 +145,10 @@ def _switch_kernel(nsargs):
|
||||
|
||||
from_running = nsargs.from_running
|
||||
kernel_package = nsargs.kernel
|
||||
pretend = nsargs.pretend
|
||||
ask = nsargs.ask
|
||||
verbose = nsargs.verbose
|
||||
quiet = nsargs.quiet
|
||||
|
||||
etp_client = None
|
||||
acquired = False
|
||||
@@ -227,18 +231,18 @@ def _switch_kernel(nsargs):
|
||||
matches = [x for x in matches if x is not None]
|
||||
matches.append(kernel_match)
|
||||
|
||||
opengl = _get_opengl_impl()
|
||||
opengl = _get_opengl_impl(pretend)
|
||||
|
||||
install = SoloInstall([])
|
||||
rc, _show_cfgupd = install._install_action(
|
||||
etp_client, True, True,
|
||||
etpUi['pretend'], etpUi['ask'], etpUi['verbose'],
|
||||
etpUi['quiet'], False, False, False, False, False,
|
||||
pretend, ask, verbose,
|
||||
quiet, False, False, False, False, False,
|
||||
False, 1, [], package_matches=list(matches))
|
||||
if _show_cfgupd:
|
||||
install._show_config_files_update(etp_client)
|
||||
|
||||
if (rc == 0) and (not etpUi['pretend']):
|
||||
if rc == 0 and not pretend:
|
||||
_set_opengl_impl(opengl)
|
||||
if target_tag:
|
||||
# if target_tag is None, we are unable to set the symlink
|
||||
@@ -276,8 +280,8 @@ def _list_kernels(nsargs):
|
||||
for pkg_id, pkg_repo in sorted(matches, key = key_sorter):
|
||||
repo = etp_client.open_repository(pkg_repo)
|
||||
print_package_info(pkg_id, etp_client, repo,
|
||||
show_repo_if_quiet = True, extended = etpUi['verbose'],
|
||||
quiet = etpUi['quiet'])
|
||||
show_repo_if_quiet = True, extended = nsargs.verbose,
|
||||
quiet = nsargs.quiet)
|
||||
|
||||
return 0
|
||||
finally:
|
||||
@@ -338,10 +342,6 @@ if __name__ == "__main__":
|
||||
parser.print_help()
|
||||
raise SystemExit(1)
|
||||
|
||||
etpUi['ask'] = getattr(nsargs, "ask", etpUi['ask'])
|
||||
etpUi['quiet'] = getattr(nsargs, "quiet", etpUi['quiet'])
|
||||
etpUi['pretend'] = getattr(nsargs, "pretend", etpUi['pretend'])
|
||||
|
||||
try:
|
||||
rc = nsargs.func(nsargs)
|
||||
except KeyboardInterrupt:
|
||||
|
||||
Reference in New Issue
Block a user