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