diff options
Diffstat (limited to 'pyuno')
-rw-r--r-- | pyuno/source/loader/makefile.mk | 4 | ||||
-rw-r--r-- | pyuno/source/loader/pyuno_loader.cxx | 2 | ||||
-rw-r--r-- | pyuno/zipcore/python.cxx | 70 | ||||
-rw-r--r-- | pyuno/zipcore/python.sh | 12 |
4 files changed, 38 insertions, 50 deletions
diff --git a/pyuno/source/loader/makefile.mk b/pyuno/source/loader/makefile.mk index 3f7a33ced13d..15c58d66aa40 100644 --- a/pyuno/source/loader/makefile.mk +++ b/pyuno/source/loader/makefile.mk @@ -90,5 +90,5 @@ ALLTAR : $(MISC)/pythonloader.component $(MISC)/pythonloader.component .ERRREMOVE : \ $(SOLARENV)/bin/createcomponent.xslt pythonloader.component $(XSLTPROC) --nonet --stringparam uri \ - 'vnd.sun.star.expand:$$OOO_BASE_DIR/program/$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt pythonloader.component + 'vnd.sun.star.expand:$$BRAND_BASE_DIR/program/$(SHL1TARGETN:f)' \ + -o $@ $(SOLARENV)/bin/createcomponent.xslt pythonloader.component diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx index f1dcf06218ef..9e93e1961c3f 100644 --- a/pyuno/source/loader/pyuno_loader.cxx +++ b/pyuno/source/loader/pyuno_loader.cxx @@ -181,7 +181,7 @@ Reference< XInterface > CreateInstance( const Reference< XComponentContext > & c { OUString pythonPath; OUString pythonHome; - OUString path( RTL_CONSTASCII_USTRINGPARAM( "$OOO_BASE_DIR/program/" SAL_CONFIGFILE("pythonloader.uno" ))); + OUString path( RTL_CONSTASCII_USTRINGPARAM( "$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("pythonloader.uno" ))); rtl::Bootstrap::expandMacros(path); //TODO: detect failure rtl::Bootstrap bootstrap(path); diff --git a/pyuno/zipcore/python.cxx b/pyuno/zipcore/python.cxx index 68991de1ff26..775a0b738f58 100644 --- a/pyuno/zipcore/python.cxx +++ b/pyuno/zipcore/python.cxx @@ -103,31 +103,20 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { wchar_t * bootstrapEnd = tools::buildPath( bootstrap + MY_LENGTH(L"vnd.sun.star.pathname:"), path, pathEnd, MY_STRING(L"fundamental.ini")); - if (bootstrapEnd == NULL || - (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) - == NULL)) - { - exit(EXIT_FAILURE); - } - pathEnd = tools::resolveLink(path); - wchar_t path1[MAX_PATH]; - wchar_t * path1End = tools::buildPath( - path1, path, pathEnd, MY_STRING(L"\\program")); - if (path1End == NULL) { + if (bootstrapEnd == NULL) { exit(EXIT_FAILURE); } wchar_t pythonpath2[MAX_PATH]; wchar_t * pythonpath2End = tools::buildPath( pythonpath2, path, pathEnd, - MY_STRING(L"\\program\\python-core-" MY_PYVERSION L"\\lib")); + MY_STRING(L"\\python-core-" MY_PYVERSION L"\\lib")); if (pythonpath2End == NULL) { exit(EXIT_FAILURE); } wchar_t pythonpath3[MAX_PATH]; wchar_t * pythonpath3End = tools::buildPath( pythonpath3, path, pathEnd, - MY_STRING( - L"\\program\\python-core-" MY_PYVERSION L"\\lib\\site-packages")); + MY_STRING(L"\\python-core-" MY_PYVERSION L"\\lib\\site-packages")); if (pythonpath3End == NULL) { exit(EXIT_FAILURE); } @@ -135,22 +124,14 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { wchar_t pythonpath4[MAX_PATH]; wchar_t * pythonpath4End = tools::buildPath( pythonpath4, path, pathEnd, - MY_STRING(L"\\program\\python-core-" MY_PYVERSION L"\\lib\\lib-dynload")); + MY_STRING(L"\\python-core-" MY_PYVERSION L"\\lib\\lib-dynload")); if (pythonpath4End == NULL) { exit(EXIT_FAILURE); } - wchar_t pythonpath5[MAX_PATH]; - wchar_t * pythonpath5End = tools::buildPath( - pythonpath5, path, pathEnd, - MY_STRING(L"\\program\\python-core-" MY_PYVERSION L"\\lib\\lib-dynload")); - if (pythonpath5End == NULL) { - exit(EXIT_FAILURE); - } #endif wchar_t pythonhome[MAX_PATH]; wchar_t * pythonhomeEnd = tools::buildPath( - pythonhome, path, pathEnd, - MY_STRING(L"\\program\\python-core-" MY_PYVERSION)); + pythonhome, path, pathEnd, MY_STRING(L"\\python-core-" MY_PYVERSION)); if (pythonhomeEnd == NULL) { exit(EXIT_FAILURE); } @@ -158,25 +139,34 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { wchar_t * pythonexeEnd = tools::buildPath( pythonexe, path, pathEnd, #ifdef __MINGW32__ - MY_STRING( - L"\\program\\python-core-" MY_PYVERSION L"\\bin\\python.bin")); + MY_STRING(L"\\python-core-" MY_PYVERSION L"\\bin\\python.bin")); #else - MY_STRING( - L"\\program\\python-core-" MY_PYVERSION L"\\bin\\python.exe")); + MY_STRING(L"\\python-core-" MY_PYVERSION L"\\bin\\python.exe")); #endif if (pythonexeEnd == NULL) { exit(EXIT_FAILURE); } - if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL) + wchar_t urepath[MAX_PATH]; + if (tools::buildPath(urepath, path, pathEnd, MY_STRING(L"..\\basis-link")) + == NULL) + { + exit(EXIT_FAILURE); + } + wchar_t * urepathEnd = urepathEnd = tools::resolveLink(urepath); + if (urepathEnd == NULL || + (tools::buildPath( + urepath, urepath, urepathEnd, MY_STRING(L"\\ure-link")) + == NULL)) { exit(EXIT_FAILURE); } - pathEnd = tools::resolveLink(path); - if (pathEnd == NULL) { + urepathEnd = tools::resolveLink(urepath); + if (urepathEnd == NULL) { exit(EXIT_FAILURE); } - pathEnd = tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin")); - if (pathEnd == NULL) { + urepathEnd = tools::buildPath( + urepath, urepath, urepathEnd, MY_STRING(L"\\bin")); + if (urepathEnd == NULL) { exit(EXIT_FAILURE); } std::size_t clSize = MY_LENGTH(L"\"") + 4 * (pythonexeEnd - pythonexe) + @@ -226,9 +216,9 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { } } wchar_t * value = new wchar_t[ - (pathEnd - path) + MY_LENGTH(L";") + (path1End - path1) + + (urepathEnd - urepath) + MY_LENGTH(L";") + (pathEnd - path) + (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1]; //TODO: overflow - wsprintfW(value, L"%s;%s%s%s", path, path1, n == 0 ? L"" : L";", orig); + wsprintfW(value, L"%s;%s%s%s", urepath, path, n == 0 ? L"" : L";", orig); if (!SetEnvironmentVariableW(L"PATH", value)) { exit(EXIT_FAILURE); } @@ -252,22 +242,20 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { } #ifdef __MINGW32__ value = new wchar_t[ - (path1End - path1) + MY_LENGTH(L";") + (pythonpath2End - pythonpath2) + + (pathEnd - path) + MY_LENGTH(L";") + (pythonpath2End - pythonpath2) + MY_LENGTH(L";") + (pythonpath4End - pythonpath4) + - MY_LENGTH(L";") + (pythonpath5End - pythonpath5) + MY_LENGTH(L";") + (pythonpath3End - pythonpath3) + (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1]; //TODO: overflow wsprintfW( - value, L"%s;%s;%s;%s;%s%s%s", path1, pythonpath2, pythonpath4, - pythonpath5, pythonpath3, + value, L"%s;%s;%s;%s%s%s", path, pythonpath2, pythonpath4, pythonpath3, n == 0 ? L"" : L";", orig); #else value = new wchar_t[ - (path1End - path1) + MY_LENGTH(L";") + (pythonpath2End - pythonpath2) + + (pathEnd - path) + MY_LENGTH(L";") + (pythonpath2End - pythonpath2) + MY_LENGTH(L";") + (pythonpath3End - pythonpath3) + (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1]; //TODO: overflow wsprintfW( - value, L"%s;%s;%s%s%s", path1, pythonpath2, pythonpath3, + value, L"%s;%s;%s%s%s", path, pythonpath2, pythonpath3, n == 0 ? L"" : L";", orig); #endif if (!SetEnvironmentVariableW(L"PYTHONPATH", value)) { diff --git a/pyuno/zipcore/python.sh b/pyuno/zipcore/python.sh index e32f1370a0d0..c6c2f4a3d749 100644 --- a/pyuno/zipcore/python.sh +++ b/pyuno/zipcore/python.sh @@ -44,7 +44,7 @@ PATH=$sd_prog${PATH+:$PATH} export PATH # Set %%OOO_LIBRARY_PATH_VAR%% so that "import pyuno" finds libpyuno.so: -%%OOO_LIBRARY_PATH_VAR%%=$sd_prog/../basis-link/program:$sd_prog/../basis-link/ure-link/lib${%%OOO_LIBRARY_PATH_VAR%%:+:$%%OOO_LIBRARY_PATH_VAR%%} +%%OOO_LIBRARY_PATH_VAR%%=$sd_prog:$sd_prog/../basis-link/ure-link/lib${%%OOO_LIBRARY_PATH_VAR%%:+:$%%OOO_LIBRARY_PATH_VAR%%} export %%OOO_LIBRARY_PATH_VAR%% # Set UNO_PATH so that "officehelper.bootstrap()" can find soffice executable: @@ -57,19 +57,19 @@ export UNO_PATH export URE_BOOTSTRAP NONMACSECTION -PYTHONPATH=$sd_prog/../basis-link/program:$sd_prog/../basis-link/program/python-core-%%PYVERSION%%/lib:$sd_prog/../basis-link/program/python-core-%%PYVERSION%%/lib/lib-dynload:$sd_prog/../basis-link/program/python-core-%%PYVERSION%%/lib/lib-tk:$sd_prog/../basis-link/program/python-core-%%PYVERSION%%/lib/site-packages${PYTHONPATH+:$PYTHONPATH} +PYTHONPATH=$sd_prog:$sd_prog/python-core-%%PYVERSION%%/lib:$sd_prog/python-core-%%PYVERSION%%/lib/lib-dynload:$sd_prog/python-core-%%PYVERSION%%/lib/lib-tk:$sd_prog/python-core-%%PYVERSION%%/lib/site-packages${PYTHONPATH+:$PYTHONPATH} export PYTHONPATH -PYTHONHOME=$sd_prog/../basis-link/program/python-core-%%PYVERSION%% +PYTHONHOME=$sd_prog/python-core-%%PYVERSION%% export PYTHONHOME # execute binary -exec "$sd_prog/../basis-link/program/python.bin" "$@" +exec "$sd_prog/python.bin" "$@" MACSECTION -PYTHONHOME=$sd_prog/../basis-link/program/OOoPython.framework +PYTHONHOME=$sd_prog/OOoPython.framework export PYTHONHOME pybasislibdir=$PYTHONHOME/Versions/%%PYVERSION%%/lib/python%%PYVERSION%% -PYTHONPATH=$sd_prog/../basis-link/program:$pybasislibdir:$pybasislibdir/lib-dynload:$pybasislibdir/lib-tk:$pybasislibdir/site-packages${PYTHONPATH+:$PYTHONPATH} +PYTHONPATH=$sd_prog:$pybasislibdir:$pybasislibdir/lib-dynload:$pybasislibdir/lib-tk:$pybasislibdir/site-packages${PYTHONPATH+:$PYTHONPATH} export PYTHONPATH # execute binary |