forked from ray-project/ray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-wheel-manylinux2014.sh
executable file
·125 lines (105 loc) · 3.86 KB
/
build-wheel-manylinux2014.sh
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
set -x
# Cause the script to exit if a single command fails.
set -euo pipefail
cat << EOF > "/usr/bin/nproc"
#!/bin/bash
echo 10
EOF
chmod +x /usr/bin/nproc
NODE_VERSION="14"
PYTHONS=("cp36-cp36m"
"cp37-cp37m"
"cp38-cp38"
"cp39-cp39"
"cp310-cp310"
"cp311-cp311")
NUMPY_VERSIONS=("1.14.5"
"1.14.5"
"1.14.5"
"1.19.3"
"1.22.0"
"1.22.0")
yum -y install unzip zip sudo
yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel xz
yum -y install openssl
if [ "${HOSTTYPE-}" = "x86_64" ]; then
yum install "libasan-4.8.5-44.el7.${HOSTTYPE}" -y
yum install "libubsan-7.3.1-5.10.el7.${HOSTTYPE}" -y
yum install "devtoolset-8-libasan-devel.${HOSTTYPE}" -y
fi
java -version
java_bin=$(readlink -f "$(command -v java)")
echo "java_bin path $java_bin"
java_home=${java_bin%jre/bin/java}
export JAVA_HOME="$java_home"
/ray/ci/env/install-bazel.sh
# Put bazel into the PATH if building Bazel from source
# export PATH=/root/bazel-3.2.0/output:$PATH:/root/bin
# If converting down to manylinux2010, the following configuration should
# be set for bazel
#echo "build --config=manylinux2010" >> /root/.bazelrc
echo "build --incompatible_linkopts_to_linklibs" >> /root/.bazelrc
if [[ -n "${RAY_INSTALL_JAVA:-}" ]]; then
bazel build //java:ray_java_pkg
unset RAY_INSTALL_JAVA
fi
# Install and use the latest version of Node.js in order to build the dashboard.
set +x
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
source "$HOME"/.nvm/nvm.sh
nvm install "$NODE_VERSION"
nvm use "$NODE_VERSION"
# Build the dashboard so its static assets can be included in the wheel.
# TODO(mfitton): switch this back when deleting old dashboard code.
pushd python/ray/dashboard/client
npm ci
npm run build
popd
set -x
# Add the repo folder to the safe.dictory global variable to avoid the failure
# because of secruity check from git, when executing the following command
# `git clean ...`, while building wheel locally.
git config --global --add safe.directory /ray
mkdir -p .whl
for ((i=0; i<${#PYTHONS[@]}; ++i)); do
PYTHON=${PYTHONS[i]}
NUMPY_VERSION=${NUMPY_VERSIONS[i]}
# The -f flag is passed twice to also run git clean in the arrow subdirectory.
# The -d flag removes directories. The -x flag ignores the .gitignore file,
# and the -e flag ensures that we don't remove the .whl directory, the
# dashboard directory and jars directory.
git clean -f -f -x -d -e .whl -e python/ray/dashboard/client -e dashboard/client -e python/ray/jars
pushd python
# Fix the numpy version because this will be the oldest numpy version we can
# support.
/opt/python/"${PYTHON}"/bin/pip install -q numpy=="${NUMPY_VERSION}" cython==0.29.32
# Set the commit SHA in __init__.py.
if [ -n "$TRAVIS_COMMIT" ]; then
sed -i.bak "s/{{RAY_COMMIT_SHA}}/$TRAVIS_COMMIT/g" ray/__init__.py && rm ray/__init__.py.bak
else
echo "TRAVIS_COMMIT variable not set - required to populated ray.__commit__."
exit 1
fi
# build ray wheel
PATH=/opt/python/${PYTHON}/bin:/root/bazel-3.2.0/output:$PATH \
/opt/python/"${PYTHON}"/bin/python setup.py bdist_wheel
# build ray-cpp wheel
PATH=/opt/python/${PYTHON}/bin:/root/bazel-3.2.0/output:$PATH \
RAY_INSTALL_CPP=1 /opt/python/"${PYTHON}"/bin/python setup.py bdist_wheel
# In the future, run auditwheel here.
mv dist/*.whl ../.whl/
popd
done
# Rename the wheels so that they can be uploaded to PyPI. TODO(rkn): This is a
# hack, we should use auditwheel instead.
for path in .whl/*.whl; do
if [ -f "${path}" ]; then
out="${path//-linux/-manylinux2014}"
if [ "$out" != "$path" ]; then
mv "${path}" "${out}"
fi
fi
done
# Clean the build output so later operations is on a clean directory.
git clean -f -f -x -d -e .whl -e python/ray/dashboard/client