From 84d599625f156f5a34e5d0d7ce331c0e11ed8c90 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 20 Feb 2018 04:26:59 -0500 Subject: [PATCH] [libcalamares] Give Python jobs a warning() - Add libcalamares.utils.warning() alongside debug() for Python modules to output warnings. --- src/libcalamares/PythonJob.cpp | 7 +++++++ src/libcalamares/PythonJobApi.cpp | 5 +++++ src/libcalamares/PythonJobApi.h | 1 + 3 files changed, 13 insertions(+) diff --git a/src/libcalamares/PythonJob.cpp b/src/libcalamares/PythonJob.cpp index 48682dbad..92dbedef9 100644 --- a/src/libcalamares/PythonJob.cpp +++ b/src/libcalamares/PythonJob.cpp @@ -99,6 +99,13 @@ BOOST_PYTHON_MODULE( libcalamares ) bp::args( "s" ), "Writes the given string to the Calamares debug stream." ); + bp::def( + "warning", + &CalamaresPython::warning, + bp::args( "s" ), + "Writes the given string to the Calamares warning stream." + ); + bp::def( "mount", &CalamaresPython::mount, diff --git a/src/libcalamares/PythonJobApi.cpp b/src/libcalamares/PythonJobApi.cpp index 9219ff1fc..a5bae6149 100644 --- a/src/libcalamares/PythonJobApi.cpp +++ b/src/libcalamares/PythonJobApi.cpp @@ -171,6 +171,11 @@ debug( const std::string& s ) cDebug() << "[PYTHON JOB]: " << QString::fromStdString( s ); } +void +warning( const std::string& s ) +{ + cWarning() << "[PYTHON JOB]: " << QString::fromStdString( s ); +} PythonJobInterface::PythonJobInterface( Calamares::PythonJob* parent ) : m_parent( parent ) diff --git a/src/libcalamares/PythonJobApi.h b/src/libcalamares/PythonJobApi.h index aed9b3d77..0e68d7936 100644 --- a/src/libcalamares/PythonJobApi.h +++ b/src/libcalamares/PythonJobApi.h @@ -66,6 +66,7 @@ boost::python::object gettext_path(); boost::python::list gettext_languages(); void debug( const std::string& s ); +void warning( const std::string& s ); class PythonJobInterface {