3
3
GCC_VERSION=${GCC_VERSION:= 8}
4
4
5
5
# Set up compilers
6
- if [ " $TEST_CODE_STYLE " == " 1" ]; then
6
+ if [[ $TEST_CODE_STYLE == " 1" ] ]; then
7
7
echo " Skipping compiler setup"
8
- elif [ " ${ OSTYPE## linux-gnu * } " == " " ]; then
8
+ elif [[ $ OSTYPE == " linux-gnu " * ] ]; then
9
9
echo " Setting up linux compiler"
10
10
echo " Installing requirements [apt]"
11
11
sudo apt-add-repository -y " ppa:ubuntu-toolchain-r/test"
12
12
sudo apt update -y -q
13
13
sudo apt install -y -q ccache gdb python-dbg python3-dbg gcc-$GCC_VERSION || exit 1
14
14
15
15
ALTERNATIVE_ARGS=" "
16
- if [ -z " ${ BACKEND##* cpp* } " ]; then
16
+ if [[ $ BACKEND == * " cpp" * ] ]; then
17
17
sudo apt install -y -q g++-$GCC_VERSION || exit 1
18
18
ALTERNATIVE_ARGS=" --slave /usr/bin/g++ g++ /usr/bin/g++-$GCC_VERSION "
19
19
fi
@@ -23,11 +23,11 @@ elif [ "${OSTYPE##linux-gnu*}" == "" ]; then
23
23
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$GCC_VERSION 60 $ALTERNATIVE_ARGS
24
24
25
25
export CC=" gcc"
26
- if [ -z " ${ BACKEND##* cpp* } " ]; then
26
+ if [[ $ BACKEND == * " cpp" * ] ]; then
27
27
sudo update-alternatives --set g++ /usr/bin/g++-$GCC_VERSION
28
28
export CXX=" g++"
29
29
fi
30
- elif [ " ${ OSTYPE## darwin * } " == " " ]; then
30
+ elif [[ $ OSTYPE == " darwin " * ] ]; then
31
31
echo " Setting up macos compiler"
32
32
export CC=" clang -Wno-deprecated-declarations"
33
33
export CXX=" clang++ -stdlib=libc++ -Wno-deprecated-declarations"
36
36
fi
37
37
38
38
# Set up miniconda
39
- if [ " $STACKLESS " == " true" ]; then
39
+ if [[ $STACKLESS == " true" ] ]; then
40
40
echo " Installing stackless python"
41
41
# conda install --quiet --yes nomkl --file=test-requirements.txt --file=test-requirements-cpython.txt
42
42
conda config --add channels stackless
@@ -50,51 +50,51 @@ echo "===================="
50
50
echo " |VERSIONS INSTALLED|"
51
51
echo " ===================="
52
52
echo " Python $PYTHON_SYS_VERSION "
53
- if [ " $CC " ]; then
53
+ if [[ $CC ] ]; then
54
54
which ${CC%% * }
55
55
${CC%% * } --version
56
56
fi
57
- if [ " $CXX " ]; then
57
+ if [[ $CXX ] ]; then
58
58
which ${CXX%% * }
59
59
${CXX%% * } --version
60
60
fi
61
61
echo " ===================="
62
62
63
63
# Install python requirements
64
64
echo " Installing requirements [python]"
65
- if [ -z " ${ PYTHON_VERSION## 2.7} " ]; then
65
+ if [[ $ PYTHON_VERSION == " 2.7" * ] ]; then
66
66
pip install wheel || exit 1
67
67
pip install -r test-requirements-27.txt || exit 1
68
- elif [ -z " ${ PYTHON_VERSION## 3. [45]* } " ]; then
68
+ elif [[ $ PYTHON_VERSION == " 3. " [45]* ] ]; then
69
69
python -m pip install wheel || exit 1
70
70
python -m pip install -r test-requirements-34.txt || exit 1
71
71
else
72
72
python -m pip install -U pip setuptools wheel || exit 1
73
73
74
- if [ -n " ${ PYTHON_VERSION##* -dev} " -o " $COVERAGE " == " 1" ]; then
74
+ if [[ $ PYTHON_VERSION != * " -dev" || $COVERAGE == " 1" ] ]; then
75
75
python -m pip install -r test-requirements.txt || exit 1
76
76
77
- if [ " ${ PYTHON_VERSION## pypy* } " -a " ${ PYTHON_VERSION## 3. [4789]* } " ]; then
77
+ if [[ $ PYTHON_VERSION != " pypy" * && $ PYTHON_VERSION != " 3. " [4789]* ] ]; then
78
78
python -m pip install -r test-requirements-cpython.txt || exit 1
79
79
fi
80
80
fi
81
81
fi
82
82
83
- if [ " $TEST_CODE_STYLE " == " 1" ]; then
84
- STYLE_ARGS=" --no-unit --no-doctest --no-file --no-pyregr --no-examples" ;
83
+ if [[ $TEST_CODE_STYLE == " 1" ] ]; then
84
+ STYLE_ARGS=" --no-unit --no-doctest --no-file --no-pyregr --no-examples"
85
85
python -m pip install -r doc-requirements.txt || exit 1
86
86
else
87
87
STYLE_ARGS=" --no-code-style"
88
88
89
89
# Install more requirements
90
- if [ -n " ${ PYTHON_VERSION##* -dev} " ]; then
91
- if [ -z " ${ BACKEND##* cpp* } " ]; then
90
+ if [[ $ PYTHON_VERSION != * " -dev" ] ]; then
91
+ if [[ $ BACKEND == * " cpp" * ] ]; then
92
92
echo " WARNING: Currently not installing pythran due to compatibility issues"
93
93
# python -m pip install pythran==0.9.5 || exit 1
94
94
fi
95
95
96
- if [ " $BACKEND " != " cpp" -a -n " ${ PYTHON_VERSION## pypy* } " -a
97
- -n " ${ PYTHON_VERSION## 2 * } " -a -n " ${ PYTHON_VERSION## 3.4* } " ]; then
96
+ if [[ $BACKEND != " cpp" && $ PYTHON_VERSION != " pypy" * &&
97
+ $ PYTHON_VERSION != " 2 " * && $ PYTHON_VERSION != " 3.4" * ] ]; then
98
98
python -m pip install mypy || exit 1
99
99
fi
100
100
fi
@@ -110,18 +110,18 @@ export PATH="/usr/lib/ccache:$PATH"
110
110
# This is true for the latest msvc, gcc and clang
111
111
CFLAGS=" -O0 -ggdb -Wall -Wextra"
112
112
113
- if [ " $NO_CYTHON_COMPILE " != " 1" -a -n " ${ PYTHON_VERSION## pypy* } " ]; then
113
+ if [[ $NO_CYTHON_COMPILE != " 1" && $ PYTHON_VERSION != " pypy" * ] ]; then
114
114
115
115
BUILD_CFLAGS=" $CFLAGS -O2"
116
116
if [[ $PYTHON_SYS_VERSION == " 2" * ]]; then
117
117
BUILD_CFLAGS=" $BUILD_CFLAGS -fno-strict-aliasing"
118
118
fi
119
119
120
120
SETUP_ARGS=" "
121
- if [ " $COVERAGE " == " 1" ]; then
121
+ if [[ $COVERAGE == " 1" ] ]; then
122
122
SETUP_ARGS=" $SETUP_ARGS --cython-coverage"
123
123
fi
124
- if [ " $CYTHON_COMPILE_ALL " == " 1" ]; then
124
+ if [[ $CYTHON_COMPILE_ALL == " 1" ] ]; then
125
125
SETUP_ARGS=" $SETUP_ARGS --cython-compile-all"
126
126
fi
127
127
SETUP_ARGS=" $SETUP_ARGS
@@ -130,15 +130,18 @@ if [ "$NO_CYTHON_COMPILE" != "1" -a -n "${PYTHON_VERSION##pypy*}" ]; then
130
130
CFLAGS=$BUILD_CFLAGS \
131
131
python setup.py build_ext -i $SETUP_ARGS || exit 1
132
132
133
- if [ -z " $COVERAGE " -a -z " $STACKLESS " -a -n " ${BACKEND//* cpp* } " -a
134
- -z " $LIMITED_API " -a -z " $CYTHON_COMPILE_ALL " -a -z " $EXTRA_CFLAGS " ]; then
133
+ # COVERAGE can be either "" (empty or not set) or "1" (when we set it)
134
+ # STACKLESS can be either "" (empty or not set) or "true" (when we set it)
135
+ # CYTHON_COMPILE_ALL can be either "" (empty or not set) or "1" (when we set it)
136
+ if [[ $COVERAGE != " 1" && $STACKLESS != " true" && $BACKEND != * " cpp" * &&
137
+ $CYTHON_COMPILE_ALL != " 1" && $LIMITED_API == " " && $EXTRA_CFLAGS == " " ]]; then
135
138
python setup.py bdist_wheel || exit 1
136
139
fi
137
140
fi
138
141
139
- if [ " $TEST_CODE_STYLE " == " 1" ]; then
140
- make -C docs html || exit 1
141
- elif [ -n " ${ PYTHON_VERSION## pypy* } " ]; then
142
+ if [[ $TEST_CODE_STYLE == " 1" ] ]; then
143
+ make -C docs html || exit 1
144
+ elif [[ $ PYTHON_VERSION != " pypy" * ] ]; then
142
145
# Run the debugger tests in python-dbg if available
143
146
# (but don't fail, because they currently do fail)
144
147
PYTHON_DBG=$( python -c ' import sys; print("%d.%d" % sys.version_info[:2])' )
@@ -150,10 +153,10 @@ elif [ -n "${PYTHON_VERSION##pypy*}" ]; then
150
153
fi
151
154
152
155
RUNTESTS_ARGS=" "
153
- if [ " $COVERAGE " == " 1" ]; then
156
+ if [[ $COVERAGE == " 1" ] ]; then
154
157
RUNTESTS_ARGS=" $RUNTESTS_ARGS --coverage --coverage-html --cython-only"
155
158
fi
156
- if [ -z " $TEST_CODE_STYLE " ]; then
159
+ if [[ $TEST_CODE_STYLE != " 1 " ] ]; then
157
160
RUNTESTS_ARGS=" $RUNTESTS_ARGS -j7"
158
161
fi
159
162
0 commit comments