|
| 1 | +#!/bin/bash |
| 2 | +set -ex |
| 3 | + |
| 4 | +script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" |
| 5 | +. "$script_dir/pkg_helpers.bash" |
| 6 | + |
| 7 | +export BUILD_TYPE=wheel |
| 8 | +setup_env |
| 9 | +setup_wheel_python |
| 10 | +pip_install numpy pyyaml future ninja |
| 11 | +pip_install --upgrade setuptools |
| 12 | +setup_pip_pytorch_version |
| 13 | +python setup.py clean |
| 14 | + |
| 15 | +# Copy binaries to be included in the wheel distribution |
| 16 | +if [[ "$(uname)" == Darwin || "$OSTYPE" == "msys" ]]; then |
| 17 | + python_exec="$(which python)" |
| 18 | + bin_path=$(dirname $python_exec) |
| 19 | + env_path=$(dirname $bin_path) |
| 20 | + if [[ "$(uname)" == Darwin ]]; then |
| 21 | + # Install delocate to relocate the required binaries |
| 22 | + pip_install "delocate>=0.9" |
| 23 | + else |
| 24 | + cp "$bin_path/Library/bin/libpng16.dll" torchvision |
| 25 | + cp "$bin_path/Library/bin/libjpeg.dll" torchvision |
| 26 | + fi |
| 27 | +else |
| 28 | + # Install auditwheel to get some inspection utilities |
| 29 | + pip_install auditwheel |
| 30 | + |
| 31 | + # Point to custom libraries |
| 32 | + export LD_LIBRARY_PATH=$(pwd)/ext_libraries/lib:$LD_LIBRARY_PATH |
| 33 | +fi |
| 34 | + |
| 35 | +if [[ "$OSTYPE" == "msys" ]]; then |
| 36 | + echo "ERROR: Windows installation is not supported yet." && exit 100 |
| 37 | +else |
| 38 | + python setup.py bdist_wheel |
| 39 | + if [[ "$(uname)" != Darwin ]]; then |
| 40 | + rename "linux_x86_64" "manylinux1_x86_64" dist/*.whl |
| 41 | + fi |
| 42 | +fi |
| 43 | + |
| 44 | +#if [[ "$(uname)" == Darwin ]]; then |
| 45 | +# pushd dist/ |
| 46 | +# python_exec="$(which python)" |
| 47 | +# bin_path=$(dirname $python_exec) |
| 48 | +# env_path=$(dirname $bin_path) |
| 49 | +# for whl in *.whl; do |
| 50 | +# DYLD_FALLBACK_LIBRARY_PATH="$env_path/lib/:$DYLD_FALLBACK_LIBRARY_PATH" delocate-wheel -v --ignore-missing-dependencies $whl |
| 51 | +# done |
| 52 | +#else |
| 53 | +# if [[ "$OSTYPE" == "msys" ]]; then |
| 54 | +# "$script_dir/windows/internal/vc_env_helper.bat" python $script_dir/wheel/relocate.py |
| 55 | +# else |
| 56 | +# LD_LIBRARY_PATH="/usr/local/lib:$CUDA_HOME/lib64:$LD_LIBRARY_PATH" python $script_dir/wheel/relocate.py |
| 57 | +# fi |
| 58 | +#fi |
0 commit comments