|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Copyright 2018 The TensorFlow Authors. All Rights Reserved. |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | +# ============================================================================== |
| 16 | + |
| 17 | +# This is based on |
| 18 | +# https://github.com/tensorflow/custom-op/blob/master/build_pip_pkg.sh |
| 19 | + |
| 20 | +set -e |
| 21 | +set -x |
| 22 | + |
| 23 | +PIP_FILE_PREFIX="bazel-bin/build_pip_pkg.runfiles/__main__/" |
| 24 | + |
| 25 | +function main() { |
| 26 | + DEST=${1} |
| 27 | + if [[ -z ${DEST} ]]; then |
| 28 | + DEST=/tmp |
| 29 | + fi |
| 30 | + |
| 31 | + mkdir -p ${DEST} |
| 32 | + DEST=$(readlink -f "${DEST}") |
| 33 | + echo "=== destination directory: ${DEST}" |
| 34 | + |
| 35 | + TMPDIR=$(mktemp -d -t tmp.XXXXXXXXXX) |
| 36 | + echo $(date) : "=== Using tmpdir: ${TMPDIR}" |
| 37 | + |
| 38 | + echo "=== Copying files" |
| 39 | + rsync -avm -L --exclude='*_test.py' --exclude='build_pip_pkg*' ${PIP_FILE_PREFIX} "${TMPDIR}" |
| 40 | + |
| 41 | + echo $(date) : "=== Building wheel" |
| 42 | + pushd ${TMPDIR} |
| 43 | + python setup.py bdist_wheel > /dev/null |
| 44 | + cp dist/*.whl "${DEST}" |
| 45 | + popd |
| 46 | + |
| 47 | + rm -rf ${TMPDIR} |
| 48 | + echo $(date) : "=== Output wheel file is in: ${DEST}" |
| 49 | +} |
| 50 | + |
| 51 | +main "$@" |
0 commit comments