2017-12-20 14:39:09 +01:00
|
|
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
2014-07-16 16:09:53 +02:00
|
|
|
*
|
|
|
|
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
|
|
|
*
|
|
|
|
* Calamares is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Calamares is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "PythonJobModule.h"
|
|
|
|
|
|
|
|
#include "PythonJob.h"
|
|
|
|
|
|
|
|
#include <QDir>
|
|
|
|
|
|
|
|
|
2018-06-18 16:56:10 +02:00
|
|
|
namespace Calamares
|
|
|
|
{
|
2014-07-16 16:09:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
Module::Type
|
|
|
|
PythonJobModule::type() const
|
|
|
|
{
|
|
|
|
return Job;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Module::Interface
|
|
|
|
PythonJobModule::interface() const
|
|
|
|
{
|
2016-10-02 19:14:56 +02:00
|
|
|
return PythonInterface;
|
2014-07-16 16:09:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
PythonJobModule::loadSelf()
|
|
|
|
{
|
|
|
|
if ( m_loaded )
|
|
|
|
return;
|
|
|
|
|
2018-06-18 16:56:10 +02:00
|
|
|
m_job = Calamares::job_ptr( new PythonJob( m_scriptFileName, m_workingPath, m_configurationMap ) );
|
2014-07-16 16:09:53 +02:00
|
|
|
m_loaded = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-11-03 15:10:37 +01:00
|
|
|
JobList
|
2014-07-22 16:54:34 +02:00
|
|
|
PythonJobModule::jobs() const
|
|
|
|
{
|
2017-11-03 15:10:37 +01:00
|
|
|
return JobList() << m_job;
|
2014-07-22 16:54:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-07-16 16:09:53 +02:00
|
|
|
void
|
2015-09-09 19:01:56 +02:00
|
|
|
PythonJobModule::initFrom( const QVariantMap& moduleDescriptor )
|
2014-07-16 16:09:53 +02:00
|
|
|
{
|
2015-09-09 19:01:56 +02:00
|
|
|
Module::initFrom( moduleDescriptor );
|
2014-07-16 16:09:53 +02:00
|
|
|
QDir directory( location() );
|
|
|
|
m_workingPath = directory.absolutePath();
|
|
|
|
|
2015-09-09 19:01:56 +02:00
|
|
|
if ( !moduleDescriptor.value( "script" ).toString().isEmpty() )
|
|
|
|
m_scriptFileName = moduleDescriptor.value( "script" ).toString();
|
2014-07-16 16:09:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PythonJobModule::PythonJobModule()
|
|
|
|
: Module()
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
PythonJobModule::~PythonJobModule()
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace Calamares
|