summaryrefslogtreecommitdiffstats
path: root/testsuite/install.sh
blob: 01c5199f2d45e3a73a3d5c83287db458f8507a75 (plain)
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
#!/bin/bash -ex

# install script for Travis-CI
PYVER=$(python -c 'import sys;print(".".join(str(v) for v in sys.version_info[0:2]))')

if [[ ${PYVER:0:1} == "2" && $PYVER != "2.7" && $PYVER != "2.6" ]]; then
    pip install -r testsuite/requirements-legacy.txt
else
    pip install --upgrade pip

    pip_wheel() {
        pip wheel --find-links="$HOME/.cache/wheels/" --wheel-dir="$HOME/.cache/wheels/" "$@"
        pip install --no-index --find-links="$HOME/.cache/wheels/" "$@"
    }

    if [[ $PYVER == "2.6" ]]; then
        pip_wheel -r testsuite/requirements-26.txt
        pip_wheel unittest2
    else
        pip_wheel -r testsuite/requirements.txt

        if [[ ${PYVER:0:1} == "3" ]]; then
            # TODO: Move to "requirements.txt" if all the new errors are fixed.
            pip_wheel 'pylint>1.4'
        fi
    fi

    if [[ "$WITH_OPTIONAL_DEPS" == "yes" ]]; then
        pip_wheel PyYAML pyinotify boto pylibacl Jinja2 \
            cherrypy python-augeas nose-show-skipped

        if [[ $PYVER == "2.6" ]]; then
            pip install \
                --global-option='build_ext' \
                --global-option='--include-dirs=/usr/include/x86_64-linux-gnu' \
                m2crypto

            pip_wheel 'django<1.7' 'South<0.8' 'mercurial<4.3' cheetah guppy
        else
            if [[ $PYVER == "2.7" ]]; then
                pip_wheel m2crypto guppy
            fi

            pip_wheel django mercurial cheetah3
        fi
    fi
fi

# Setup the local xml schema cache
download_schema() {
    if [[ ! -e "$1" ]]; then
        wget -O "$1" "$2"
    fi
}

mkdir -p "$HOME/.cache/xml/"
download_schema "$HOME/.cache/xml/XMLSchema.xsd" "http://www.w3.org/2001/XMLSchema.xsd"
download_schema "$HOME/.cache/xml/xml.xsd" "http://www.w3.org/2001/xml.xsd"

cat > "$HOME/.cache/xml/catalog.xml" <<EOF
<?xml version="1.0"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
  <system systemId="http://www.w3.org/2001/XMLSchema.xsd" uri="$HOME/.cache/xml/XMLSchema.xsd" />
  <system systemId="http://www.w3.org/2001/xml.xsd" uri="$HOME/.cache/xml/xml.xsd" />
  <nextCatalog catalog="/etc/xml/catalog.xml" />
</catalog>
EOF