Issue 16214 - Executing python scripts in win32-tcsh environment
Summary: Executing python scripts in win32-tcsh environment
Status: CLOSED FIXED
Alias: None
Product: udk
Classification: Code
Component: code (show other issues)
Version: OOo 1.1 Beta2
Hardware: PC Linux, all
: P3 Trivial (vote)
Target Milestone: OOo 1.1 RC
Assignee: joergbudi
QA Contact: issues@udk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-29 17:18 UTC by joergbudi
Modified: 2003-07-31 09:19 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Contains one line for each environment, where the PYTHON var must be added (156 bytes, patch)
2003-06-29 18:15 UTC, joergbudi
no flags Details | Diff
Patch for solenv/bin/guw.pl in order to support python (1.37 KB, patch)
2003-06-29 18:16 UTC, joergbudi
no flags Details | Diff
To see the effects of the other changes (don't commit, jbu will do this !) (3.11 KB, patch)
2003-06-29 18:21 UTC, joergbudi
no flags Details | Diff
Patch for solenv/bin/guw.pl (692 bytes, patch)
2003-07-01 09:23 UTC, quetschke
no flags Details | Diff
Patch for pyuno/test/makefile.mk (2.23 KB, patch)
2003-07-01 09:24 UTC, quetschke
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description joergbudi 2003-06-29 17:18:22 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
Comment 1 joergbudi 2003-06-29 17:19:45 UTC
I currently evaluate a solution for the problem, I hope you can review
and commit my patches later on.
Comment 2 joergbudi 2003-06-29 17:23:29 UTC
set target
Comment 3 joergbudi 2003-06-29 18:15:32 UTC
Created attachment 7224 [details]
Contains one line for each environment, where the PYTHON var must be added
Comment 4 joergbudi 2003-06-29 18:16:59 UTC
Created attachment 7225 [details]
Patch for solenv/bin/guw.pl in order to support python
Comment 5 joergbudi 2003-06-29 18:21:24 UTC
Created attachment 7226 [details]
To see the effects of the other changes (don't commit, jbu will do this !)
Comment 6 joergbudi 2003-06-29 18:22:40 UTC
Hi,

Volker, can you review and commit the guw.pl patch and add the
variable to the env-scripts ?
Comment 7 quetschke 2003-06-29 23:35:19 UTC
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.
Comment 8 joergbudi 2003-06-30 06:49:10 UTC
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
Comment 9 quetschke 2003-07-01 09:23:17 UTC
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?
Comment 10 quetschke 2003-07-01 09:23:58 UTC
Created attachment 7290 [details]
Patch for solenv/bin/guw.pl
Comment 11 quetschke 2003-07-01 09:24:40 UTC
Created attachment 7292 [details]
Patch for pyuno/test/makefile.mk
Comment 12 quetschke 2003-07-01 09:59:32 UTC
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
Comment 13 joergbudi 2003-07-01 19:28:29 UTC
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
Comment 14 quetschke 2003-07-01 21:34:43 UTC
> 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!
----
Comment 15 quetschke 2003-07-01 21:40:28 UTC
Committed patch to guw.pl in RC, back to you Joerg!
Comment 16 joergbudi 2003-07-01 23:02:44 UTC
Commited vq patch for the pyuno/test/makefile.mk
Comment 17 quetschke 2003-07-01 23:37:57 UTC
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?
Comment 18 joergbudi 2003-07-03 06:17:56 UTC
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).
Comment 19 joergbudi 2003-07-31 09:19:17 UTC
closing fixed issues for 1.1. release.