Python: use warning() method in modules

This commit is contained in:
Adriaan de Groot 2018-02-20 04:42:56 -05:00
parent 84d599625f
commit 060990bdd0
2 changed files with 8 additions and 6 deletions

View File

@ -7,6 +7,7 @@
# Copyright 2015-2017, Teo Mrnjavac <teo@kde.org> # Copyright 2015-2017, Teo Mrnjavac <teo@kde.org>
# Copyright 2016-2017, Kyle Robbertze <kyle@aims.ac.za> # Copyright 2016-2017, Kyle Robbertze <kyle@aims.ac.za>
# Copyright 2017, Alf Gaida <agaida@siduction.org> # Copyright 2017, Alf Gaida <agaida@siduction.org>
# Copyright 2018, Adriaan de Groot <groot@kde.org>
# #
# Calamares is free software: you can redistribute it and/or modify # Calamares is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -394,9 +395,9 @@ def run_operations(pkgman, entry):
try: try:
pkgman.install_package(package) pkgman.install_package(package)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
warn_text = "WARNING: could not install package " warn_text = "Could not install package "
warn_text += str(package) warn_text += str(package)
libcalamares.utils.debug(warn_text) libcalamares.utils.warning(warn_text)
elif key == "remove": elif key == "remove":
_change_mode(REMOVE) _change_mode(REMOVE)
pkgman.remove(entry[key]) pkgman.remove(entry[key])
@ -406,9 +407,9 @@ def run_operations(pkgman, entry):
try: try:
pkgman.remove([package]) pkgman.remove([package])
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
warn_text = "WARNING: could not remove package " warn_text = "Could not remove package "
warn_text += package warn_text += package
libcalamares.utils.debug(warn_text) libcalamares.utils.warning(warn_text)
elif key == "localInstall": elif key == "localInstall":
_change_mode(INSTALL) _change_mode(INSTALL)
pkgman.install(entry[key], from_local=True) pkgman.install(entry[key], from_local=True)
@ -441,7 +442,7 @@ def run():
skip_this = libcalamares.job.configuration.get("skip_if_no_internet", False) skip_this = libcalamares.job.configuration.get("skip_if_no_internet", False)
if skip_this and not libcalamares.globalstorage.value("hasInternet"): if skip_this and not libcalamares.globalstorage.value("hasInternet"):
libcalamares.utils.debug( "WARNING: packages installation has been skipped: no internet" ) libcalamares.utils.warning( "Package installation has been skipped: no internet" )
return None return None
update_db = libcalamares.job.configuration.get("update_db", False) update_db = libcalamares.job.configuration.get("update_db", False)

View File

@ -5,6 +5,7 @@
# #
# Copyright 2014, Aurélien Gâteau <agateau@kde.org> # Copyright 2014, Aurélien Gâteau <agateau@kde.org>
# Copyright 2016, Anke Boersma <demm@kaosx.us> # Copyright 2016, Anke Boersma <demm@kaosx.us>
# Copyright 2018, Adriaan de Groot <groot@kde.org>
# #
# Calamares is free software: you can redistribute it and/or modify # Calamares is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -65,7 +66,7 @@ def run():
try: try:
shutil.copy2(log_source, log_destination) shutil.copy2(log_source, log_destination)
except Exception as e: except Exception as e:
libcalamares.utils.debug("WARNING Could not preserve file {!s}, " libcalamares.utils.warning("Could not preserve file {!s}, "
"error {!s}".format(log_source, e)) "error {!s}".format(log_source, e))
if not root_mount_point: if not root_mount_point: