File: installer_test.sh

package info (click to toggle)
spyder 6.1.3%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 25,744 kB
  • sloc: python: 130,956; sh: 411; xml: 149; javascript: 131; cpp: 67; makefile: 21; ansic: 19; erlang: 15; lisp: 11; java: 5
file content (94 lines) | stat: -rwxr-xr-x 2,903 bytes parent folder | download
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
93
94
#!/usr/bin/env bash

# This script tests the installer for macOS and Linux on CI
# and will only install for the local user.

exit_status=0

install() {
    if [[ "$OSTYPE" == "darwin"* ]]; then
        # Stream install.log to stdout to view all log messages.
        tail -F /var/log/install.log & tail_id=$!
        trap "kill -s TERM $tail_id" EXIT

        installer -pkg $PKG_PATH -target CurrentUserHomeDirectory >/dev/null
    elif [[ "$OSTYPE" == "linux"* ]]; then
        $PKG_PATH -b
    fi
}

check_prefix() {
    if [[ "$OSTYPE" == "darwin"* ]]; then
        base_prefix=$(compgen -G $HOME/Library/spyder-*)
    elif [[ "$OSTYPE" == "linux"* ]]; then
        base_prefix=$(compgen -G $HOME/.local/spyder-*)
    fi

    if [[ -d "$base_prefix" ]]; then
        echo -e "\nContents of ${base_prefix}:"
        ls -al $base_prefix
    else
        echo "ERROR: Base prefix does not exist!"
        exit 1
    fi
}

check_uninstall() {
    if [[ -e "${base_prefix}/uninstall-spyder.sh" ]]; then
        echo -e "\nContents of ${base_prefix}/uninstall-spyder.sh:"
        cat $base_prefix/uninstall-spyder.sh
    else
        echo "ERROR: ${base_prefix}/uninstall-spyder.sh does not exist!"
        exit_status=1
    fi
}

check_shortcut() {
    pythonexe=${base_prefix}/bin/python
    menuinst=${base_prefix}/bin/menuinst_cli.py
    for menu in \
        ${base_prefix}/envs/spyder-runtime/Menu/spyder-menu.json \
        ${base_prefix}/Menu/uninstall-menu.json;
    do
        shortcut=$($pythonexe $menuinst shortcut --mode=user --menu=$menu)
        if [[ -e "${shortcut}" ]]; then
            if [[ "$OSTYPE" == "darwin"* ]]; then
                echo -e "\nContents of ${shortcut}/Contents/MacOS:"
                ls -al "${shortcut}/Contents/MacOS"
                echo -e "\nContents of $shortcut/Contents/Info.plist:"
                cat "${shortcut}/Contents/Info.plist"
                script=$(compgen -G "${shortcut}/Contents/MacOS/spyder"*-script)
                echo -e "\nContents of ${script}:"
                cat "${script}"
                echo ""
            elif [[ "$OSTYPE" == "linux"* ]]; then
                echo -e "\nContents of ${shortcut}:"
                cat $shortcut
            fi
        else
            echo "ERROR: $shortcut does not exist"
            exit_status=1
        fi
    done
}

check_spyder_version() {
    runtime_python=${base_prefix}/envs/spyder-runtime/bin/python
    actual_version=$(${runtime_python} -c "import spyder; print(spyder.__version__)")
    echo -e "\nExpected version = ${SPYVER}"
    echo "Actual version   = ${actual_version}"
    if [[ "${SPYVER}" != "${actual_version}" ]]; then
        echo "ERROR: installed Spyder version is incorrect!"
        exit_status=1
    fi
}

install || exit 1
echo -e "\n#############"
echo "Install info:"
check_prefix
check_uninstall
check_shortcut
check_spyder_version

exit $exit_status