|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | +# contributor license agreements. See the NOTICE file distributed with |
| 4 | +# this work for additional information regarding copyright ownership. |
| 5 | +# The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | +# (the "License"); you may not use this file except in compliance with |
| 7 | +# the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +set -e -x |
| 17 | + |
| 18 | +## 1. install python env |
| 19 | +dev/lint-python.sh -s py_env |
| 20 | + |
| 21 | +PY_ENV_DIR=`pwd`/dev/.conda/envs |
| 22 | +py_env=("3.8" "3.9" "3.10" "3.11") |
| 23 | +## 2. install dependency |
| 24 | +for ((i=0;i<${#py_env[@]};i++)) do |
| 25 | + echo "Installing dependencies for environment: ${py_env[i]}" |
| 26 | + ${PY_ENV_DIR}/${py_env[i]}/bin/pip install -r dev/dev-requirements.txt |
| 27 | +done |
| 28 | + |
| 29 | +## 3. build wheels |
| 30 | +for ((i=0;i<${#py_env[@]};i++)) do |
| 31 | + echo "Building wheel for environment: ${py_env[i]}" |
| 32 | + if [[ "$(uname)" != "Darwin" ]]; then |
| 33 | + # force the linker to use the older glibc version in Linux |
| 34 | + export CFLAGS="-I. -include dev/glibc_version_fix.h" |
| 35 | + fi |
| 36 | + ${PY_ENV_DIR}/${py_env[i]}/bin/python setup.py bdist_wheel |
| 37 | +done |
| 38 | + |
| 39 | +## 4. convert linux_x86_64 wheel to manylinux1 wheel in Linux |
| 40 | +if [[ "$(uname)" != "Darwin" ]]; then |
| 41 | + echo "Converting linux_x86_64 wheel to manylinux1" |
| 42 | + source `pwd`/dev/.conda/bin/activate |
| 43 | + # 4.1 install patchelf |
| 44 | + conda install -c conda-forge patchelf=0.11 -y |
| 45 | + # 4.2 install auditwheel |
| 46 | + pip install auditwheel==3.2.0 |
| 47 | + # 4.3 convert Linux wheel |
| 48 | + for wheel_file in dist/*.whl; do |
| 49 | + auditwheel repair ${wheel_file} -w dist |
| 50 | + rm -f ${wheel_file} |
| 51 | + done |
| 52 | + source deactivate |
| 53 | +fi |
| 54 | +## see the result |
| 55 | +ls -al dist/ |
0 commit comments