From 686addf5778065fac6642d31919933770abf2d87 Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Tue, 25 Aug 2009 13:07:56 +0000 Subject: CWS-TOOLING: integrate CWS sb110 2009-08-05 15:28:43 +0200 sb r274677 : CWS-TOOLING: rebase CWS sb110 to trunk@274622 (milestone: DEV300:m54) 2009-08-05 11:46:36 +0200 sb r274646 : #i104018# fixed previous svn changeset 271712 (from issue 101244) 2009-07-20 14:41:56 +0200 sb r274138 : CWS-TOOLING: rebase CWS sb110 to trunk@273858 (milestone: DEV300:m52) 2009-06-02 11:42:17 +0200 sb r272489 : CWS-TOOLING: rebase CWS sb110 to trunk@272291 (milestone: DEV300:m49) 2009-05-08 12:46:51 +0200 sb r271712 : #i101244# after DLLs have been moved from basis to brand layer on Windows, code that used SvtPathOptions::GetModulePath to located libraries had to be adapted 2009-05-08 10:10:43 +0200 sb r271703 : #i101244# for performance reasons, on Windows move DLLs from basis to brand layer (i.e., next to executables); consequently eliminated some library duplications across the layers; adapted various code to the move 2009-05-08 09:54:44 +0200 sb r271702 : #i101244# hardwire Python dynamic libraries and script files into base layer (even if other dynamic libraries will move to brand layer on Windows), mainly because the pyuno dynamic library is both linked against from other dynamic libraries (pythonloader.uno) and accessed via "import pyuno" from Python scripts 2009-05-07 17:18:30 +0200 sb r271686 : #i101244# support NativeServicesURLPrefix on individual files; to implement that, changed meaning of global unomaxservices 2009-05-07 17:15:24 +0200 sb r271685 : #i101244# take legacy_binfilters.rdb explicitly from $OOO_BASE_DIR/program (instead of implicitly next to some dynamic library); cleaned up dead code 2009-05-07 17:12:12 +0200 sb r271684 : #i101244# take senddoc.exe explicitly from $OOO_BASE_DIR/program (instead of implicitly next to some dynamic library) 2009-05-07 17:11:33 +0200 sb r271683 : #i101244# take odbcconfig.exe explicitly from $OOO_BASE_DIR/program (instead of implicitly next to some dynamic library) 2009-05-07 17:09:44 +0200 sb r271682 : #i101244# read configmgr ini file explicitly from $OOO_BASE_DIR/program (instead of next to configmgr dynamic library) --- pyuno/source/loader/pyuno_loader.cxx | 37 ++++++------------------------------ 1 file changed, 6 insertions(+), 31 deletions(-) (limited to 'pyuno/source/loader/pyuno_loader.cxx') diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx index a6ceb8c4e160..bed549bca19f 100644 --- a/pyuno/source/loader/pyuno_loader.cxx +++ b/pyuno/source/loader/pyuno_loader.cxx @@ -30,7 +30,6 @@ #include -#include #include #include #include @@ -116,27 +115,6 @@ Sequence< OUString > getSupportedServiceNames() return Sequence< OUString > ( &serviceName, 1 ); } -static OUString getLibDir() -{ - static OUString *pLibDir; - if( !pLibDir ) - { - osl::MutexGuard guard( osl::Mutex::getGlobalMutex() ); - if( ! pLibDir ) - { - static OUString libDir; - - if( osl::Module::getUrlFromAddress( - reinterpret_cast< oslGenericFunction >(getLibDir) , libDir ) ) - { - libDir = OUString( libDir.getStr(), libDir.lastIndexOf('/' ) ); - } - pLibDir = &libDir; - } - } - return *pLibDir; -} - static void setPythonHome ( const OUString & pythonHome ) { OUString systemPythonHome; @@ -190,16 +168,13 @@ Reference< XInterface > CreateInstance( const Reference< XComponentContext > & c { OUString pythonPath; OUString pythonHome; - OUString path = getLibDir(); - if( path.getLength() ) - { - path += OUString( RTL_CONSTASCII_USTRINGPARAM( "/" SAL_CONFIGFILE("pythonloader.uno" ))); - rtl::Bootstrap bootstrap(path); + OUString path( RTL_CONSTASCII_USTRINGPARAM( "$OOO_BASE_DIR/program/" SAL_CONFIGFILE("pythonloader.uno" ))); + rtl::Bootstrap::expandMacros(path); //TODO: detect failure + rtl::Bootstrap bootstrap(path); - // look for pythonhome - bootstrap.getFrom( OUString( RTL_CONSTASCII_USTRINGPARAM( "PYUNO_LOADER_PYTHONHOME") ), pythonHome ); - bootstrap.getFrom( OUString( RTL_CONSTASCII_USTRINGPARAM( "PYUNO_LOADER_PYTHONPATH" ) ) , pythonPath ); - } + // look for pythonhome + bootstrap.getFrom( OUString( RTL_CONSTASCII_USTRINGPARAM( "PYUNO_LOADER_PYTHONHOME") ), pythonHome ); + bootstrap.getFrom( OUString( RTL_CONSTASCII_USTRINGPARAM( "PYUNO_LOADER_PYTHONPATH" ) ) , pythonPath ); // 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 -- cgit