xref: /trunk/main/pyuno/zipcore/python.sh (revision 28b67305)
1#!/bin/sh
2#**************************************************************
3#
4#  Licensed to the Apache Software Foundation (ASF) under one
5#  or more contributor license agreements.  See the NOTICE file
6#  distributed with this work for additional information
7#  regarding copyright ownership.  The ASF licenses this file
8#  to you under the Apache License, Version 2.0 (the
9#  "License"); you may not use this file except in compliance
10#  with the License.  You may obtain a copy of the License at
11#
12#    http://www.apache.org/licenses/LICENSE-2.0
13#
14#  Unless required by applicable law or agreed to in writing,
15#  software distributed under the License is distributed on an
16#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17#  KIND, either express or implied.  See the License for the
18#  specific language governing permissions and limitations
19#  under the License.
20#
21#**************************************************************
22
23# resolve installation directory
24sd_cwd="`pwd`"
25if [ -h "$0" ] ; then
26	sd_basename=`basename "$0"`
27 	sd_script=`ls -l "$0" | sed "s/.*${sd_basename} -> //g"`
28    cd "`dirname "$0"`"
29    cd "`dirname "$sd_script"`"
30else
31    cd "`dirname "$0"`"
32fi
33sd_prog=`pwd`
34cd "$sd_cwd"
35
36# Set PATH so that crash_report is found:
37PATH=$sd_prog${PATH+:$PATH}
38export PATH
39
40# Set LD_LIBRARY_PATH so that "import pyuno" finds libpyuno.so:
41LD_LIBRARY_PATH=$sd_prog:${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
42export LD_LIBRARY_PATH
43
44# Set UNO_PATH so that "officehelper.bootstrap()" can find soffice executable:
45: ${UNO_PATH=$sd_prog}
46export UNO_PATH
47
48# Set URE_BOOTSTRAP so that "uno.getComponentContext()" bootstraps a complete
49# OOo UNO environment:
50: ${URE_BOOTSTRAP=vnd.sun.star.pathname:$sd_prog/fundamentalrc}
51export URE_BOOTSTRAP
52
53PYTHONPATH=$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}
54export PYTHONPATH
55PYTHONHOME=$sd_prog/python-core-%%PYVERSION%%
56export PYTHONHOME
57
58# execute binary
59exec "$sd_prog/python.bin" "$@"
60