Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
84d67614
Commit
84d67614
authored
Oct 26, 2022
by
Waqar Ahmed
Committed by
Christoph Cullmann
Oct 27, 2022
Browse files
make it compile and link
parent
6ce0133b
Pipeline
#256600
canceled with stage
in 2 minutes and 29 seconds
Changes
5
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
addons/python/CMakeLists.txt
View file @
84d67614
...
...
@@ -49,7 +49,9 @@ target_link_libraries(
KF5::I18n
KF5::TextEditor
Shiboken2::libshiboken
PySide2::pyside2
${
Python3_LIBRARIES
}
PyKate
)
target_sources
(
...
...
addons/python/PyKate/CMakeLists.txt
View file @
84d67614
...
...
@@ -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}
#
)
addons/python/katepythonplugin.cpp
View file @
84d67614
...
...
@@ -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
*
)
...
...
addons/python/pythonutils.cpp
View file @
84d67614
...
...
@@ -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
;
...
...
cmake/PySide2ModuleBuild.cmake
View file @
84d67614
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment