File: configure_tools

package info (click to toggle)
eprover 2.6%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 21,288 kB
  • sloc: ansic: 331,111; csh: 12,026; python: 10,178; awk: 5,825; makefile: 461; sh: 389
file content (92 lines) | stat: -rwxr-xr-x 2,601 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh

mywhich()
{
    which $1|grep -v '^no'
    return $?
}


if tail -n+2 $0 > /dev/null; then
   TAIL="tail -n";
else
   TAIL="tail ";
fi
echo "Using $TAIL"

if which this_should_never_exist_XHSLA12930; then
   echo "Your which command is broken, using workaround!"
   WHICH=mywhich
else
   echo "Your which command works!"
   WHICH=which
fi



if $WHICH gawk; then
    AWK=`which gawk`;
    echo "configure_tools: Found gawk in your search path"
elif $WHICH awk; then
    AWK=`which awk`;
    echo "configure_tools: Cannot find gawk, trying awk (untested)"
else
    echo "configure_tools: No awk available, tools unconfigured."
    echo "configure_tools: Try to get gawk installed in your search path."
    exit 0;
fi

for file in *.awk ; do
    # cp $file $file.bak
    echo "#!$AWK -f" > tmpfile
    $TAIL +2 $file >> tmpfile
    mv tmpfile $file
    chmod ugo+x $file
done


if $WHICH python2.8; then
    PYTHON_DUMMY=`which python2.8`;
    echo "configure_tools: Found Python 2.8 in your search path"
elif $WHICH python2.7; then
    PYTHON_DUMMY=`which python2.7`;
    echo "configure_tools: Found Python 2.7 in your search path"
elif $WHICH python2.6; then
    PYTHON_DUMMY=`which python2.6`;
    echo "configure_tools: Found Python 2.6 in your search path"
elif $WHICH python2.5; then
    PYTHON_DUMMY=`which python2.5`;
    echo "configure_tools: Found Python 2.5 in your search path"
elif $WHICH python2.4; then
    PYTHON_DUMMY=`which python2.4`;
    echo "configure_tools: Found Python 2.4 in your search path"
elif $WHICH python2.3; then
    PYTHON_DUMMY=`which python2.3`;
    echo "configure_tools: Found Python 2.3 in your search path"
elif $WHICH python2.2; then
    PYTHON_DUMMY=`which python2.2`;
    echo "configure_tools: Found Python 2.2 in your search path"
elif $WHICH python2.1; then
    PYTHON_DUMMY=`which python2.1`;
    echo "configure_tools: Found Python 2.1 in your search path"
elif $WHICH python2; then
    PYTHON_DUMMY=`which python2`;
    echo "configure_tools: Found Python 2 in your search path"
elif $WHICH python; then
    PYTHON_DUMMY=`which python`;
    echo "configure_tools: Found Python in your search path (Note: Required version >=2.0, otherwise expect trouble)"
else
    echo "configure_tools: No Python available, tools unconfigured."
    echo "configure_tools: Try to get Python 2.X installed in your search path."
    exit 0;
fi

PYTHON_DUMMY=`basename $PYTHON_DUMMY`

for file in *.py ; do
    # cp $file $file.bak
    echo "#!/usr/bin/env $PYTHON_DUMMY" > tmpfile
    $TAIL +2 $file >> tmpfile
    mv tmpfile $file
    chmod ugo+x $file
done