Apache OpenOffice (AOO) Bugzilla – Issue 16214
Executing python scripts in win32-tcsh environment
Last modified: 2003-07-31 09:19:17 UTC
In order to execute python scripts in a win32-tcsh environment, the following things need to be done: - add PYTHON environment variable which shall encaspulate all occurences, where the python interpreter is invoked. - add PYTHONPATH and PYTHONHOME environment variables in the guw.pl - adapt pyuno/test makefile, so that it passes also the test in this env
I currently evaluate a solution for the problem, I hope you can review and commit my patches later on.
set target
Created attachment 7224 [details] Contains one line for each environment, where the PYTHON var must be added
Created attachment 7225 [details] Patch for solenv/bin/guw.pl in order to support python
Created attachment 7226 [details] To see the effects of the other changes (don't commit, jbu will do this !)
Hi, Volker, can you review and commit the guw.pl patch and add the variable to the env-scripts ?
Hi Joerg, it's late and I had no time to really test your patches, but can make a few comments. guw.pl-python-patch: The regcomp change is OK, but the PYTHONPATH and PYTHONHOME variables are already in dos style and don't need to be changed from POSIX to DOS for tcsh. (issue 15778) env-patch: All we need is propably: PYTHON=$(WRAPCMD) python This should propably go into unitools.mk Ause: unitools.mk or a new *.mk? Suggestions? The definitions for PYTHONPATH and PYTHONHOME should also move from set_soenv to this *.mk. pyuno-test-makefile.mk-patch: The + .IF "$(USE_SHELL)" != "tcsh" DOLLAR_SIGN=$$ .ENDIF part of the patch is inside the + .IF "$(GUI)" == "UNX" ... section, i.e. not used for W32-tcsh. Make it + REGCOMP=$(WRAPCMD) regcomp + PYTHON=$(WRAPCMD) python and you don't need a special case for W32-tcsh I'll have a deeper look tomorrow.
Hi, > PYTHONPATH and PYTHONHOME variables are > already in dos style In case we can define these env variables in dos-style, everything will be a lot easier as you said. I will check your configure patch therefor this evening. Putting the python variable into a .mk file is fine (wasn't sure about the strategy here, some other commands are defined in the env-script). Bye, Joerg
Hi Joerg, I applied guw_py.diff and pyuno_mk.diff (following as attachments) to my local tree, with: [q@lisi ...pyuno/test]$ echo $PYTHONHOME e:\w1\cws_srx645_ooo11rccyg\solver\645\wntmsci9.pro [q@lisi ...pyuno/test]$ echo $PYTHONPATH .;e:\w1\cws_srx645_ooo11rccyg\solver\645\wntmsci9.pro\lib;e:\w1\cws_srx645_ooo11rccyg\solver\645\wntmsci9.pro\lib\python;e:\w1\cws_srx645_ooo11rccyg\solver\645\wntmsci9.pro\lib\python\lib-dynload and a dmake testrun yields: ---- mkout -- version: 1.3 cp pyuno ../wntmsci9.pro/bin/pyuno.ini cp /w1/cws_srx645_ooo11rccyg/solver/645/wntmsci9.pro/bin/udkapi.rdb ../wntmsci9.pro/bin/pyuno_types.rdb cp core.py ../wntmsci9.pro/bin/core.py cp importer.py ../wntmsci9.pro/bin/importer.py cp main.py ../wntmsci9.pro/bin/main.py cp impl.py ../wntmsci9.pro/bin/impl.py cp samplecomponent.py ../wntmsci9.pro/bin/samplecomponent.py cp testcomp.py ../wntmsci9.pro/bin/testcomp.py cp /w1/cws_srx645_ooo11rccyg/solver/645/wntmsci9.pro/bin/udkapi.rdb ../wntmsci9.pro/bin/pyuno_regcomp.rdb regmerge ../wntmsci9.pro/bin/pyuno_regcomp.rdb / ../wntmsci9.pro/bin/pyuno_services.rdb merging registry "../wntmsci9.pro/bin/pyuno_services.rdb" under key "/" in registry "../wntmsci9.pro/bin/pyuno_regcomp.rdb". start test with dmake runtest cp /w1/cws_srx645_ooo11rccyg/solver/645/wntmsci9.pro/bin/python.exe ../wntmsci9.pro/bin/python.exe cp /w1/cws_srx645_ooo11rccyg/solver/645/wntmsci9.pro/bin/regcomp.exe ../wntmsci9.pro/bin/regcomp.exe ------------------------------ Making: ../wntmsci9.pro/misc/test.dpc dmake subdmake=true -f makefile.mk depend=t ALLDPC ------------------------------ No Dependencies ------------- cd ../wntmsci9.pro/bin && guw.pl python main.py Command: python Traceback (most recent call last): File "main.py", line 62, in ? import uno ImportError: No module named uno dmake: Error code 1, while making 'runtest' echo: No match. ---- What next?
Created attachment 7290 [details] Patch for solenv/bin/guw.pl
Created attachment 7292 [details] Patch for pyuno/test/makefile.mk
Sorry Joerg, cockpit error on my side. I tool a clean pyuno dir, applied the patch and made dmake testrun. I forgot building/delivering the module first. Ok, second try. Logfile with a build/delivered pyuno module: ---- cp pyuno ../wntmsci9.pro/bin/pyuno.ini cp /w1/cws_srx645_ooo11rccyg/solver/645/wntmsci9.pro/bin/udkapi.rdb ../wntmsci9.pro/bin/pyuno_types.rdb cp core.py ../wntmsci9.pro/bin/core.py cp importer.py ../wntmsci9.pro/bin/importer.py cp main.py ../wntmsci9.pro/bin/main.py cp impl.py ../wntmsci9.pro/bin/impl.py cp samplecomponent.py ../wntmsci9.pro/bin/samplecomponent.py cp testcomp.py ../wntmsci9.pro/bin/testcomp.py cp /w1/cws_srx645_ooo11rccyg/solver/645/wntmsci9.pro/bin/udkapi.rdb ../wntmsci9.pro/bin/pyuno_regcomp.rdb regmerge ../wntmsci9.pro/bin/pyuno_regcomp.rdb / ../wntmsci9.pro/bin/pyuno_services.rdb merging registry "../wntmsci9.pro/bin/pyuno_services.rdb" under key "/" in registry "../wntmsci9.pro/bin/pyuno_regcomp.rdb". start test with dmake runtest cp /w1/cws_srx645_ooo11rccyg/solver/645/wntmsci9.pro/bin/python.exe ../wntmsci9.pro/bin/python.exe cp /w1/cws_srx645_ooo11rccyg/solver/645/wntmsci9.pro/bin/regcomp.exe ../wntmsci9.pro/bin/regcomp.exe ------------------------------ Making: ../wntmsci9.pro/misc/test.dpc dmake subdmake=true -f makefile.mk depend=t ALLDPC ------------------------------ No Dependencies ------------- cd ../wntmsci9.pro/bin && guw.pl python main.py Command: python Traceback (most recent call last): File "main.py", line 73, in ? unohelper.addComponentsToContext(ctx,ctx,("cppobj.uno","bridgetest.uno","streams.uno"),"com.sun.star.loader.SharedLibrary") File "unohelper.py", line 238, in addComponentsToContext implReg.registerImplementation( loaderName,componentUrl, reg ) unohelper.com.sun.star.registry.CannotRegisterImplementationException: loading component library failed: cppobj.uno.dll dmake: Error code 1, while making 'runtest' echo: No match. ---- I don't think that I have a cppobj.uno.dll anywhere, at least not in python, pyuno or solver. Volker
Hi Volker, you need to build and deliver the testtools on HEAD. This is currently not included in the normal build, as there is only testcode included. You should then be able to run the tests. Bye, Joerg
> you need to build and deliver the testtools on HEAD. Aha ;-) Now it works, see logfile below. I'll commit the guw.pl patch in a minute. Volker ---- cp pyuno ../wntmsci9.pro/bin/pyuno.ini cp /w1/cws_srx645_ooo11rccyg/solver/645/wntmsci9.pro/bin/udkapi.rdb ../wntmsci9.pro/bin/pyuno_types.rdb cp core.py ../wntmsci9.pro/bin/core.py cp importer.py ../wntmsci9.pro/bin/importer.py cp main.py ../wntmsci9.pro/bin/main.py cp impl.py ../wntmsci9.pro/bin/impl.py cp samplecomponent.py ../wntmsci9.pro/bin/samplecomponent.py cp testcomp.py ../wntmsci9.pro/bin/testcomp.py cp /w1/cws_srx645_ooo11rccyg/solver/645/wntmsci9.pro/bin/udkapi.rdb ../wntmsci9.pro/bin/pyuno_regcomp.rdb regmerge ../wntmsci9.pro/bin/pyuno_regcomp.rdb / ../wntmsci9.pro/bin/pyuno_services.rdb merging registry "../wntmsci9.pro/bin/pyuno_services.rdb" under key "/" in registry "../wntmsci9.pro/bin/pyuno_regcomp.rdb". start test with dmake runtest cp /w1/cws_srx645_ooo11rccyg/solver/645/wntmsci9.pro/bin/python.exe ../wntmsci9.pro/bin/python.exe cp /w1/cws_srx645_ooo11rccyg/solver/645/wntmsci9.pro/bin/regcomp.exe ../wntmsci9.pro/bin/regcomp.exe ------------------------------ Making: ../wntmsci9.pro/misc/test.dpc dmake subdmake=true -f makefile.mk depend=t ALLDPC ------------------------------ No Dependencies ------------- cd ../wntmsci9.pro/bin && guw.pl python main.py Command: python testStandard (importer.ImporterTestCase) ... ok testDynamicComponentRegistration (importer.ImporterTestCase) ... ok testErrors (core.TestCase) ... ok testBaseTypes (core.TestCase) ... ok testOutparam (core.TestCase) ... ok testStruct (core.TestCase) ... ok testType (core.TestCase) ... ok testEnum (core.TestCase) ... ok testBool (core.TestCase) ... ok testChar (core.TestCase) ... ok testUnicode (core.TestCase) ... ok testConstant (core.TestCase) ... ok testExceptions (core.TestCase) ... ok testInterface (core.TestCase) ... ok testByteSequence (core.TestCase) ... ok testInvoke (core.TestCase) ... ok testStandard (impl.TestCase) ... ok testUrlHelper (impl.TestHelperCase) ... ok testInspect (impl.TestHelperCase) ... ok ---------------------------------------------------------------------- Ran 19 tests in 0.120s OK cd ../wntmsci9.pro/bin && guw.pl regcomp -register -br pyuno_regcomp.rdb -r dummy.rdb -l com.sun.star.loader.Python -c vnd.openoffice.pymodule:samplecomponent Command: regcomp register component 'vnd.openoffice.pymodule:samplecomponent' in registry 'dummy.rdb' succesful! Command: echo cd ../wntmsci9.pro/bin && setenv FOO file:///e:/w1/cws_srx645_ooo11rccyg/pyuno/test/../wntmsci9.pro/bin && guw.pl regcomp -register -br pyuno_regcomp.rdb -r dummy2.rdb -l com.sun.star.loader.Python -c vnd.sun.star.expand:\$FOO/samplecomponent.py Command: regcomp register component 'vnd.sun.star.expand:$FOO/samplecomponent.py' in registry 'dummy2.rdb' succesful! ----
Committed patch to guw.pl in RC, back to you Joerg!
Commited vq patch for the pyuno/test/makefile.mk
Joerg, do we still need the PYTHON=$(WRAPCMD) python somewhere? I think it's not really correct in unitools.mk, but it wouldn't hurt there. Ause?
I think, we should have this variable for potential other places, where python may get used (and you need to reference files in other directories).
closing fixed issues for 1.1. release.