Skip to content

Commit

Permalink
Fixup -e / add a basic sanity check that all packages have at least one
Browse files Browse the repository at this point in the history
prebuilt wheel.
  • Loading branch information
jsirois committed Oct 7, 2017
1 parent 38b955f commit 5aa928a
Showing 1 changed file with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions build-support/bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ source ${ROOT}/contrib/release_packages.sh

function find_pkg() {
local readonly pkg_name=$1
find "${ROOT}/dist/${pkg_name}-$(local_version)/dist" \
-type f \
-name "${pkg_name}-$(local_version)-*.whl"
local readonly search_dir=${2:-${ROOT}/dist/${pkg_name}-$(local_version)/dist}
find "${search_dir}" -type f -name "${pkg_name}-$(local_version)-*.whl"
}

function find_plat_name() {
Expand Down Expand Up @@ -470,18 +469,48 @@ function fetch_prebuilt_wheels() {
local readonly to_dir="$1"

banner "Fetching prebuilt wheels for $(local_version)"

(
cd "${to_dir}"
list_prebuilt_wheels | {
while read path
do
curl -O "${BINARY_BASE_URL}/${path}"
echo "${BINARY_BASE_URL}/${path}:"
curl --progress-bar -O "${BINARY_BASE_URL}/${path}"
done
}
)
}

function check_prebuilt_wheels() {
local check_dir="$1"
if [[ -z "${check_dir}" ]]
then
check_dir=$(mktemp -d -t pants.wheel_check.XXXXX)
trap "rm -rf ${check_dir}" RETURN
fi

banner "Checking prebuilt wheels for $(local_version)"
fetch_prebuilt_wheels "${check_dir}"

local missing=()
for PACKAGE in "${RELEASE_PACKAGES[@]}"
do
NAME=$(pkg_name $PACKAGE)
packages=($(find_pkg "${NAME}" "${check_dir}"))
(( ${#packages[@]} > 0 )) || missing+=("${NAME}")
done

if (( ${#missing[@]} > 0 ))
then
echo "Failed to find prebuilt packages for:"
for package in "${missing[@]}"
do
echo " ${package}"
done
die
fi
}

function activate_twine() {
local readonly venv_dir="${ROOT}/build-support/twine-deps.venv"

Expand All @@ -497,7 +526,7 @@ function publish_packages() {

start_travis_section "Publishing" "Publishing packages"

fetch_prebuilt_wheels "${DEPLOY_WHEEL_DIR}"
check_prebuilt_wheels "${DEPLOY_WHEEL_DIR}"

activate_twine
trap deactivate RETURN
Expand Down

0 comments on commit 5aa928a

Please sign in to comment.