Ticket #38: skeleton.1

File skeleton.1, 1.1 kB (added by Jan-Nik, 4 months ago)

Okay here's an updated skeleton. I have tested it, but I'm not sure if everything is right.

Line 
1 [Meta]
2 RootName: @python.org/python
3 DisplayName: Python language runtime
4 ShortName: python
5 Skeleton-Author: Jan Niklas Hasse <jhasse@gmail.com>
6 Skeleton-Version: 2
7
8 [Notes]
9 Tests all available python executables. For example if python2.4 and python2.5
10 are installed, INTERFACE_VERSIONS is "2.5 2.4" and SOFTWARE_VERSIONS is set to
11 the output of "python2.4 -V" and "python2.5 -V".
12
13 [Test]
14 SOFTWARE_VERSIONS=$( locateCommand python -V 2>&1 | cut -f2 -d' ' )
15 if [[ "$?" != "0" ]]; then
16     INTERFACE_VERSIONS=""
17 else
18     INTERFACE_VERSIONS=$( echo $SOFTWARE_VERSIONS | awk -F. '{print $1 "." $2}' )
19 fi
20
21 major=1
22 major_max=3
23 default=$SOFTWARE_VERSIONS
24 # Test for python1.0, python1.1, ... python3.8, python3.9
25 while [[ "$major" -le "$major_max" ]]
26 do
27         minor=0
28         while [[ "$minor" -le "9" ]]
29         do
30                 if hash "python$major.$minor" 2> /dev/null; then
31                         v=$( locateCommand python$major.$minor -V 2>&1 | cut -f2 -d' ' )
32                         if [[ "$?" == "0" && "$v" != "$default" ]]; then
33                                 SOFTWARE_VERSIONS="$SOFTWARE_VERSIONS $v"
34                                 INTERFACE_VERSIONS="$INTERFACE_VERSIONS $( echo $v | awk -F. '{print $1 "." $2}' )"
35                         fi
36                 fi
37                 minor=$((minor+1))
38         done
39         major=$((major+1));
40 done