Commit 84d67614 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

make it compile and link

parent 6ce0133b
Pipeline #256600 canceled with stage
in 2 minutes and 29 seconds
......@@ -49,7 +49,9 @@ target_link_libraries(
KF5::I18n
KF5::TextEditor
Shiboken2::libshiboken
PySide2::pyside2
${Python3_LIBRARIES}
PyKate
)
target_sources(
......
......@@ -51,7 +51,6 @@ set(PyKate_target_link_libraries
# changes on these files should trigger a new generation
set(PyKate_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/kate_python.h
# ${CMAKE_SOURCE_DIR}/src/
)
create_python_bindings(
......@@ -71,6 +70,6 @@ create_python_bindings(
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.cmake ${CMAKE_CURRENT_BINARY_DIR}/__init__.py @ONLY)
# install
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/__init__.py $<TARGET_FILE:PyKate>
DESTINATION ${PYTHON_BINDINGS_INSTALL_PREFIX}
)
# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/__init__.py $<TARGET_FILE:PyKate>
# DESTINATION ${PYTHON_BINDINGS_INSTALL_PREFIX}
# )
......@@ -6,6 +6,7 @@
*/
#include "katepythonplugin.h"
#include "pythonutils.h"
#include <KPluginFactory>
......@@ -14,6 +15,8 @@ K_PLUGIN_FACTORY_WITH_JSON(KatePythonPluginFactory, "katepythonplugin.json", reg
KatePythonPlugin::KatePythonPlugin(QObject *application, const QList<QVariant> &)
: KTextEditor::Plugin(application)
{
qDebug() << "init res; " << PythonUtils::init();
PythonUtils::runScript({QStringLiteral("print('hello world')")});
}
QObject *KatePythonPlugin::createView(KTextEditor::MainWindow *)
......
......@@ -17,8 +17,8 @@
/* from AppLib bindings */
extern "C" PyObject *PyInit_AppLib();
static const char moduleName[] = "AppLib";
extern "C" PyObject *PyInit_Kate();
static const char moduleName[] = "Kate";
// This variable stores all Python types exported by this module.
extern PyTypeObject **SbkAppLibTypes;
......@@ -62,7 +62,7 @@ State init()
if (qEnvironmentVariableIsSet(virtualEnvVar))
initVirtualEnvironment();
if (PyImport_AppendInittab(moduleName, PyInit_AppLib) == -1) {
if (PyImport_AppendInittab(moduleName, PyInit_Kate) == -1) {
qWarning("Failed to add the module '%s' to the table of built-in modules.", moduleName);
return state;
}
......@@ -70,7 +70,7 @@ State init()
Py_Initialize();
qAddPostRoutine(cleanup);
state = PythonInitialized;
const bool pythonInitialized = PyInit_AppLib() != nullptr;
const bool pythonInitialized = PyInit_Kate() != nullptr;
const bool pyErrorOccurred = PyErr_Occurred() != nullptr;
if (pythonInitialized && !pyErrorOccurred) {
state = AppModuleLoaded;
......
......@@ -133,7 +133,7 @@ macro(create_python_bindings
set(TARGET_NAME "Py${libraryName}")
set(MODULE_NAME "${libraryName}")
add_library(${TARGET_NAME} MODULE ${outputSource})
add_library(${TARGET_NAME} STATIC ${outputSource})
set_target_properties(
${TARGET_NAME} PROPERTIES
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment