run.in 2.56 KB
Newer Older
1
#!/bin/sh
2
# -*- coding: utf-8 -*-
3
# Copyright (C) 2010, 2011, 2014, 2015, 2016 Laboratoire de Recherche et
4
# Developpement de l'EPITA (LRDE).
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
5
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6
6
# (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
7
# Pierre et Marie Curie.
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
8
9
10
11
12
#
# This file is part of Spot, a model checking library.
#
# Spot is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
13
# the Free Software Foundation; either version 3 of the License, or
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
14
15
16
17
18
19
20
21
# (at your option) any later version.
#
# Spot is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
22
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
23

24
25
26
# Darwin needs some help in figuring out where non-installed libtool
# libraries are (on this platform libtool encodes the expected final
# path of dependent libraries in each library).
27
28
modpath='@abs_top_builddir@/python/.libs:@abs_top_builddir@/python/spot/.libs'
modpath=$modpath:'@top_builddir@/spot/.libs:@top_builddir@/buddy/spot/.libs'
29

30
# We need access to both the *.py files, and the *.so.  We used to
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
31
32
33
# rely on a module called ltihooks.py to teach the import function how
# to load a Libtool library, but it started to cause issues with
# Python 2.6.
34
35
36
37
38
39
40
pypath=
for i in python python/spot; do
    for j in '@abs_top_builddir@' '@abs_top_srcdir@'; do
	pypath=$j/$i:$j/$i/.libs:$pypath
    done
done
pypath=${pypath%:}
41

42
PATH="@abs_top_builddir@/bin:$PATH"
43
44
export PATH

45
test -z "$1" &&
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
    PYTHONPATH=$pypath DYLD_LIBRARY_PATH=$modpath exec @PYTHON@
srcdir="@srcdir@"

case $1 in
    */*)
	dir=${1%/*}
	dir=${dir##*/}
	mkdir -p $dir
	cd $dir
	case $1 in
	    ../*)
		base=../$1
		;;
	    [\\/$]* | ?:[\\/]* )
		base=$1
		;;
	    *)
		base=${1##*/}
		;;
	esac

	test $srcdir != '.' && srcdir="@abs_srcdir@/$dir"
        shift
        set x "$base" "$@"
	shift
	;;
esac

export srcdir
75
76

case $1 in
77
78
  *.ipynb)
    PYTHONPATH=$pypath DYLD_LIBRARY_PATH=$modpath \
79
    exec $PREFIXCMD @PYTHON@ @abs_srcdir@/python/ipnbdoctest.py "$@";;
80
  *.py)
81
82
    PYTHONPATH=$pypath DYLD_LIBRARY_PATH=$modpath \
    exec $PREFIXCMD @PYTHON@ "$@";;
83
  *.test)
84
    exec sh -x "$@";;
85
86
  *.pl)
    exec @PERL@ "$@";;
87
  *python*)
88
89
    PYTHONPATH=$pypath DYLD_LIBRARY_PATH=$modpath \
    exec $PREFIXCMD "$@";;
90
  *)
91
    echo "Unknown extension" >&2
92
93
    exit 2;;
esac