1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23
24PRJ=..$/..$/..
25
26PRJNAME=pyuno
27TARGET=test
28LIBTARGET=NO
29TARGETTYPE=CUI
30ENABLE_EXCEPTIONS=TRUE
31
32my_components = component/pyuno/source/loader/pythonloader
33
34# --- Settings -----------------------------------------------------
35
36.INCLUDE :  settings.mk
37# --- Files --------------------------------------------------------
38.IF "$(L10N_framework)"==""
39PYEXC=$(DLLDEST)$/python$(EXECPOST)
40REGEXC=$(DLLDEST)$/regcomp$(EXECPOST)
41
42.IF "$(SYSTEM_PYTHON)"!="YES"
43PYTHON=$(AUGMENT_LIBRARY_PATH) $(WRAPCMD) $(SOLARBINDIR)/python
44.ELSE                   # "$(SYSTEM_PYTHON)"!="YES"
45PYTHON=$(AUGMENT_LIBRARY_PATH) $(WRAPCMD) python
46.ENDIF                  # "$(SYSTEM_PYTHON)"!="YES"
47.IF "$(GUI)"=="WNT"
48PYTHONPATH:=$(SOLARLIBDIR)$/pyuno;$(PWD);$(SOLARLIBDIR);$(SOLARLIBDIR)$/python;$(SOLARLIBDIR)$/python$/lib-dynload
49.ELSE                   # "$(GUI)"=="WNT"
50PYTHONPATH:=$(SOLARLIBDIR)$/pyuno:$(PWD):$(SOLARLIBDIR):$(SOLARLIBDIR)$/python:$(SOLARLIBDIR)$/python$/lib-dynload
51.ENDIF                  # "$(GUI)"=="WNT"
52.EXPORT: PYTHONPATH
53
54.IF "$(GUI)"!="WNT" && "$(GUI)"!="OS2"
55TEST_ENV=export FOO=file://$(shell @pwd)$/$(DLLDEST) \
56    UNO_TYPES=uno_types.rdb UNO_SERVICES=pyuno_services.rdb
57.ELSE # "$(GUI)" != "WNT"
58# aaaaaa, how to get the current working directory on windows ???
59CWD_TMP=$(strip $(shell @echo "import os;print os.getcwd()" | $(PYTHON)))
60TEST_ENV=export FOO=file:///$(strip $(subst,\,/ $(CWD_TMP)$/$(DLLDEST))) && \
61		export UNO_TYPES=uno_types.rdb && export UNO_SERVICES=pyuno_services.rdb
62.ENDIF  # "$(GUI)"!="WNT"
63PYFILES = \
64	$(DLLDEST)$/core.py			\
65	$(DLLDEST)$/importer.py			\
66	$(DLLDEST)$/main.py			\
67	$(DLLDEST)$/impl.py			\
68	$(DLLDEST)$/samplecomponent.py		\
69	$(DLLDEST)$/testcomp.py			\
70
71PYCOMPONENTS = \
72	samplecomponent
73
74ALL : 	\
75	$(PYFILES)				\
76    $(DLLDEST)/pyuno_services.rdb \
77	doc					\
78	ALLTAR
79.ENDIF # L10N_framework
80
81.INCLUDE :  target.mk
82.IF "$(L10N_framework)"==""
83$(DLLDEST)$/%.py: %.py
84	cp $? $@
85
86$(DLLDEST)$/python$(EXECPOST) : $(SOLARBINDIR)$/python$(EXECPOST)
87	cp $? $@
88
89$(DLLDEST)$/regcomp$(EXECPOST) : $(SOLARBINDIR)$/regcomp$(EXECPOST)
90	cp $? $@
91
92$(DLLDEST)$/pyuno_services.rdb .ERRREMOVE : \
93        $(SOLARENV)/bin/packcomponents.xslt $(MISC)/pyuno_services.input \
94        $(my_components:^"$(SOLARXMLDIR)/":+".component")
95    $(XSLTPROC) --nonet --stringparam prefix $(SOLARXMLDIR)/ -o $@ \
96        $(SOLARENV)/bin/packcomponents.xslt $(MISC)/pyuno_services.input
97
98$(MISC)/pyuno_services.input :
99    echo \
100        '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \
101        > $@
102
103doc .PHONY:
104	@echo start test with  dmake runtest
105
106runtest : ALL
107    cd $(DLLDEST) && $(TEST_ENV) && $(PYTHON) main.py
108.ENDIF # L10N_framework
109
110