blob: 569a4a0c996786f7f46b2450ea250103bdb4f4f3 (
plain) (
blame)
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
|
#!/bin/bash
# Global config
project="$1"
root=/static
logdir="${root}/logs"
sysconfdir="${root}/etc"
staging="${root}/staging"
wheelhouse="${root}/wheelhouse"
path_orig="${PATH}"
# Build config
source "${sysconfdir}/config.sh"
source "${sysconfdir}/functions.sh"
if [[ -z $project ]]; then
exit 255
fi
# Configure user to talk to artifactory (two-way)
pushd "${HOME}" &>/dev/null
msg2 "Configuring pip and setuptools..."
mkdir -p $HOME/.pip
[[ -f ${sysconfdir}/pip.conf ]] && cp -a ${sysconfdir}/pip.conf ${HOME}/.pip
[[ -f ${sysconfdir}/pypirc ]] && cp -a ${sysconfdir}/pypirc .pypirc
popd &>/dev/null
# Enter build directory
msg2 "Entering build directory"
cd /io
mkdir -p ${staging}/${project}
# Install forced dependencies
# Our packages are tend to be very inconsistent
for build_env in "${envs[@]}"; do
PYBIN=/opt/python/${build_env}/bin
export PATH="${PYBIN}:${path_orig}"
hash -r
pip install -q -r ${sysconfdir}/dev-requirements.txt 1>/dev/null
done
# Iterate through Python environments
msg2 "Building packages"
for build_env in "${envs[@]}"; do
PYBIN=/opt/python/${build_env}/bin
export PATH="${PYBIN}:${path_orig}"
hash -r
python_version=$(python -V 2>&1 | awk '{ print $2 }')
project_version=$(git describe --long --tags 2>/dev/null || msg Unknown)
BYTE_COMPILE=$(find . -type f -iname '*.c' -o -iname '*.f')
# Setup logging
logroot=${logdir}/${python_version}/${project}/${project_version}
mkdir -p "${logroot}"
for dist in bdist_wheel sdist; do
msg3 "[${python_version}][${dist}][${project}-${project_version}]"
python setup.py ${dist} -d ${staging}/${project} \
1>${logroot}/${dist}.stdout \
2>${logroot}/${dist}.stderr
if [[ $? != 0 ]] && [[ ${dist} == bdist_wheel ]]; then
# Ahhhhhhhrrrrrrrgggg
pip wheel -w ${staging}/${project} ${dist} \
1>${logroot}/${dist}.stdout \
2>${logroot}/${dist}.stderr
fi
# On failure, write log to console
if [[ $? != 0 ]]; then
cat ${logroot}/${dist}.stderr
fi
done
# When not compiling Python extensions don't continue on
# to the next interpreter version
if [[ ! ${BYTE_COMPILE} ]]; then
break
fi
done
echo
|