Bugzilla – Attachment 191534 Details for
Bug 158447
Use PyConfig for setting Python home directory
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to use PyConfig
pyuno_loader_config.patch (text/plain), 1.94 KB, created by
Buovjaga
on 2023-12-20 17:11:15 UTC
(
hide
)
Description:
Patch to use PyConfig
Filename:
MIME Type:
Creator:
Buovjaga
Created:
2023-12-20 17:11:15 UTC
Size:
1.94 KB
patch
obsolete
>diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx >index 05a03fe72c4d..44fc885a3dc0 100644 >--- a/pyuno/source/loader/pyuno_loader.cxx >+++ b/pyuno/source/loader/pyuno_loader.cxx >@@ -105,7 +105,7 @@ static PyRef getObjectFromLoaderModule( const char * func ) > return object; > } > >-static void setPythonHome ( const OUString & pythonHome ) >+static void setPythonHome ( const OUString & pythonHome, PyConfig * config ) > { > OUString systemPythonHome; > osl_getSystemPathFromFileURL( pythonHome.pData, &(systemPythonHome.pData) ); >@@ -129,9 +129,7 @@ static void setPythonHome ( const OUString & pythonHome ) > PyErr_SetString(PyExc_SystemError, "python home path is too long"); > return; > } >-SAL_WNODEPRECATED_DECLARATIONS_PUSH >- Py_SetPythonHome(wide); // deprecated since python 3.11 >-SAL_WNODEPRECATED_DECLARATIONS_POP >+ config->home = wide; > } > > static void prependPythonPath( std::u16string_view pythonPathBootstrap ) >@@ -183,11 +181,13 @@ void pythonInit() { > if ( Py_IsInitialized()) // may be inited by getComponentContext() already > return; > >+ PyConfig config; > OUString pythonPath; > OUString pythonHome; > OUString path( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("pythonloader.uno" )); > rtl::Bootstrap::expandMacros(path); //TODO: detect failure > rtl::Bootstrap bootstrap(path); >+ PyConfig_InitPythonConfig( &config ); > > // look for pythonhome > bootstrap.getFrom( "PYUNO_LOADER_PYTHONHOME", pythonHome ); >@@ -196,7 +196,7 @@ void pythonInit() { > // pythonhome+pythonpath must be set before Py_Initialize(), otherwise there appear warning on the console > // sadly, there is no api for setting the pythonpath, we have to use the environment variable > if( !pythonHome.isEmpty() ) >- setPythonHome( pythonHome ); >+ setPythonHome( pythonHome, &config ); > > if( !pythonPath.isEmpty() ) > prependPythonPath( pythonPath );
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 158447
: 191534