Python: get docstring from run() method

This commit is contained in:
Adriaan de Groot 2017-07-05 06:28:32 -04:00 committed by Philip
parent b28edfdc8e
commit 7ff814790d
2 changed files with 6 additions and 0 deletions

View File

@ -228,6 +228,7 @@ PythonJob::PythonJob( const QString& scriptFile,
: Job( parent ) : Job( parent )
, m_scriptFile( scriptFile ) , m_scriptFile( scriptFile )
, m_workingPath( workingPath ) , m_workingPath( workingPath )
, m_description()
, m_configurationMap( moduleConfiguration ) , m_configurationMap( moduleConfiguration )
{ {
} }
@ -293,6 +294,10 @@ PythonJob::exec()
scriptNamespace ); scriptNamespace );
bp::object entryPoint = scriptNamespace[ "run" ]; bp::object entryPoint = scriptNamespace[ "run" ];
bp::extract< std::string > entryPoint_doc_attr(entryPoint.attr( "__doc__" ) );
if ( entryPoint_doc_attr.check() )
m_description = QString::fromStdString( entryPoint_doc_attr() );
bp::object runResult = entryPoint(); bp::object runResult = entryPoint();

View File

@ -53,6 +53,7 @@ private:
CalamaresPython::Helper* helper(); CalamaresPython::Helper* helper();
QString m_scriptFile; QString m_scriptFile;
QString m_workingPath; QString m_workingPath;
QString m_description;
QVariantMap m_configurationMap; QVariantMap m_configurationMap;
}; };