CalamaresPrivate ==> CalamaresPython
This commit is contained in:
parent
568f2abd0b
commit
2f03dfa43b
@ -38,7 +38,7 @@ public:
|
||||
, m_queue( queue )
|
||||
{
|
||||
#ifdef WITH_PYTHON
|
||||
new CalamaresPrivate::PythonJobHelper( this );
|
||||
new CalamaresPython::Helper( this );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -40,9 +40,9 @@ BOOST_PYTHON_MODULE( libcalamares )
|
||||
bp::scope().attr( "VERSION" ) = CALAMARES_VERSION;
|
||||
bp::scope().attr( "VERSION_SHORT" ) = CALAMARES_VERSION_SHORT;
|
||||
|
||||
bp::class_< CalamaresPrivate::PythonJobInterface >( "job", bp::init< const Calamares::PythonJob* >() )
|
||||
.def( "prettyName", &CalamaresPrivate::PythonJobInterface::prettyName )
|
||||
.def( "workingPath", &CalamaresPrivate::PythonJobInterface::workingPath );
|
||||
bp::class_< CalamaresPython::PythonJobInterface >( "job", bp::init< const Calamares::PythonJob* >() )
|
||||
.def( "prettyName", &CalamaresPython::PythonJobInterface::prettyName )
|
||||
.def( "workingPath", &CalamaresPython::PythonJobInterface::workingPath );
|
||||
}
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ PythonJob::exec()
|
||||
bp::object calamaresModule = bp::import( "libcalamares" );
|
||||
bp::dict calamaresNamespace = bp::extract< bp::dict >( calamaresModule.attr( "__dict__" ) );
|
||||
|
||||
calamaresNamespace[ "job" ] = CalamaresPrivate::PythonJobInterface( this );
|
||||
calamaresNamespace[ "job" ] = CalamaresPython::PythonJobInterface( this );
|
||||
|
||||
bp::object result = bp::exec_file( scriptFI.absoluteFilePath().toLocal8Bit().data(),
|
||||
scriptNamespace,
|
||||
@ -134,10 +134,10 @@ PythonJob::exec()
|
||||
}
|
||||
|
||||
|
||||
CalamaresPrivate::PythonJobHelper*
|
||||
CalamaresPython::Helper*
|
||||
PythonJob::helper()
|
||||
{
|
||||
return CalamaresPrivate::PythonJobHelper::s_instance;
|
||||
return CalamaresPython::Helper::s_instance;
|
||||
|
||||
}
|
||||
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
#include "Job.h"
|
||||
|
||||
namespace CalamaresPrivate
|
||||
namespace CalamaresPython
|
||||
{
|
||||
class PythonJobInterface;
|
||||
class PythonJobHelper;
|
||||
class Helper;
|
||||
}
|
||||
|
||||
namespace Calamares {
|
||||
@ -42,9 +42,9 @@ public:
|
||||
JobResult exec() override;
|
||||
|
||||
private:
|
||||
friend class CalamaresPrivate::PythonJobHelper;
|
||||
friend class CalamaresPrivate::PythonJobInterface;
|
||||
CalamaresPrivate::PythonJobHelper* helper();
|
||||
friend class CalamaresPython::Helper;
|
||||
friend class CalamaresPython::PythonJobInterface;
|
||||
CalamaresPython::Helper* helper();
|
||||
QString m_scriptFile;
|
||||
QString m_workingPath;
|
||||
};
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "PythonJobApi.h"
|
||||
|
||||
|
||||
namespace CalamaresPrivate
|
||||
namespace CalamaresPython
|
||||
{
|
||||
|
||||
PythonJobInterface::PythonJobInterface( const Calamares::PythonJob* parent )
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "PythonJob.h"
|
||||
|
||||
namespace CalamaresPrivate
|
||||
namespace CalamaresPython
|
||||
{
|
||||
|
||||
class PythonJobInterface
|
||||
|
@ -29,11 +29,11 @@
|
||||
|
||||
namespace bp = boost::python;
|
||||
|
||||
namespace CalamaresPrivate {
|
||||
namespace CalamaresPython {
|
||||
|
||||
PythonJobHelper* PythonJobHelper::s_instance = nullptr;
|
||||
Helper* Helper::s_instance = nullptr;
|
||||
|
||||
PythonJobHelper::PythonJobHelper( QObject* parent )
|
||||
Helper::Helper( QObject* parent )
|
||||
: QObject( parent )
|
||||
{
|
||||
// Let's make extra sure we only call Py_Initialize once
|
||||
@ -81,12 +81,12 @@ PythonJobHelper::PythonJobHelper( QObject* parent )
|
||||
s_instance = this;
|
||||
}
|
||||
|
||||
PythonJobHelper::~PythonJobHelper()
|
||||
Helper::~Helper()
|
||||
{}
|
||||
|
||||
|
||||
boost::python::object
|
||||
PythonJobHelper::createCleanNamespace()
|
||||
Helper::createCleanNamespace()
|
||||
{
|
||||
// To make sure we run each script with a clean namespace, we only fetch the
|
||||
// builtin namespace from the interpreter as it was when freshly initialized.
|
||||
@ -98,7 +98,7 @@ PythonJobHelper::createCleanNamespace()
|
||||
|
||||
|
||||
QString
|
||||
PythonJobHelper::handleLastError()
|
||||
Helper::handleLastError()
|
||||
{
|
||||
using namespace boost::python;
|
||||
using namespace boost;
|
||||
|
@ -26,22 +26,22 @@
|
||||
#undef slots
|
||||
#include <boost/python/object.hpp>
|
||||
|
||||
namespace CalamaresPrivate {
|
||||
namespace CalamaresPython {
|
||||
|
||||
class PythonJobHelper : public QObject
|
||||
class Helper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PythonJobHelper( QObject* parent = nullptr );
|
||||
virtual ~PythonJobHelper();
|
||||
explicit Helper( QObject* parent = nullptr );
|
||||
virtual ~Helper();
|
||||
|
||||
boost::python::object createCleanNamespace();
|
||||
|
||||
QString handleLastError();
|
||||
|
||||
private:
|
||||
friend PythonJobHelper* Calamares::PythonJob::helper();
|
||||
static PythonJobHelper* s_instance;
|
||||
friend Helper* Calamares::PythonJob::helper();
|
||||
static Helper* s_instance;
|
||||
|
||||
boost::python::object m_mainModule;
|
||||
boost::python::object m_mainNamespace;
|
||||
|
@ -39,12 +39,10 @@
|
||||
// Example module.conf
|
||||
/*
|
||||
---
|
||||
type: "core" #core or view
|
||||
type: "view" #job or view
|
||||
name: "foo" #the module name. must be unique and same as the parent directory
|
||||
interface: "qtplugin" #can be: qtplugin, python, process, ...
|
||||
requires: [] #list of module names that must also be loaded. only applies to
|
||||
#binary plugins! these are actual link-time dependencies, not
|
||||
#conceptual dependencies for the setup procedure
|
||||
requires: [] #list of module names that must also be loaded before this one
|
||||
*/
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user