diff options
author | Sarper Akdemir <sarper.akdemir.extern@allotropia.de> | 2023-12-19 10:59:34 +0300 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2024-04-30 11:17:01 +0200 |
commit | 74396c2e16e0b7807cf7c0bdf369acad9f821341 (patch) | |
tree | 4faecddf6267142965e5c205c8608d136d630310 /pyuno | |
parent | 12f8b7c611bd31cedc457520922f9e9a97d83b51 (diff) |
tdf#158375: add expert option DisablePythonRuntime
When DisablePythonRuntime is set, anything that utilizes pyuno
bindings won't work (e.g. python macros and extensions).
Change-Id: Id42d01647eebee42b120b399470a1f944e4ba00f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160968
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'pyuno')
-rw-r--r-- | pyuno/Library_pythonloader.mk | 5 | ||||
-rw-r--r-- | pyuno/source/loader/pyuno_loader.cxx | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/pyuno/Library_pythonloader.mk b/pyuno/Library_pythonloader.mk index 4e3776b84897..2f1e69cfaef8 100644 --- a/pyuno/Library_pythonloader.mk +++ b/pyuno/Library_pythonloader.mk @@ -9,6 +9,10 @@ $(eval $(call gb_Library_Library,pythonloader)) +$(eval $(call gb_Library_use_custom_headers,pythonloader,\ + officecfg/registry \ +)) + $(eval $(call gb_Library_set_componentfile,pythonloader,pyuno/source/loader/pythonloader,pyuno)) $(eval $(call gb_Library_set_include,pythonloader,\ @@ -22,6 +26,7 @@ $(eval $(call gb_Library_use_api,pythonloader,\ )) $(eval $(call gb_Library_use_libraries,pythonloader,\ + comphelper \ cppu \ cppuhelper \ pyuno \ diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx index 05a03fe72c4d..afdb016aa764 100644 --- a/pyuno/source/loader/pyuno_loader.cxx +++ b/pyuno/source/loader/pyuno_loader.cxx @@ -36,6 +36,8 @@ #include <com/sun/star/uno/XComponentContext.hpp> +#include <officecfg/Office/Common.hxx> + // apparently PATH_MAX is not standard and not defined by MSVC #ifndef PATH_MAX #ifdef _MAX_PATH @@ -242,6 +244,9 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* pyuno_Loader_get_implementation( css::uno::XComponentContext* ctx , css::uno::Sequence<css::uno::Any> const&) { + if (officecfg::Office::Common::Security::Scripting::DisablePythonRuntime::get()) + return nullptr; + // tdf#114815 init python only once, via single-instace="true" in pythonloader.component pythonInit(); |